From 7ffe84fdce94e03c7d8c7f654cbb112c76dea20b Mon Sep 17 00:00:00 2001 From: wanghaibin Date: Sat, 19 Aug 2017 01:00:19 +0800 Subject: [PATCH] irqbalance: Fix the compile warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fix the compile warningis like as folow: ui/irqbalance-ui.c:147:20: warning: ‘ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized] new_irq->class = strtol(strtok_r(NULL, " ", &ptr), NULL, 10); Signed-off-by: wanghaibin --- ui/irqbalance-ui.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c index 9215877..3fc46af 100644 --- a/ui/irqbalance-ui.c +++ b/ui/irqbalance-ui.c @@ -125,6 +125,8 @@ void parse_setup(char *setup_data) char *copy; if((setup_data == NULL) || (strlen(setup_data) == 0)) return; copy = strdup(setup_data); + if (!copy) + return; setup.banned_irqs = NULL; setup.banned_cpus = NULL; @@ -243,6 +245,9 @@ void parse_into_tree(char *data) return; copy = strdup(data); + if (!copy) + return; + token = strtok_r(copy, " ", &ptr); while(token != NULL) { /* Parse node data */