From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0A0561B161 for ; Tue, 19 Sep 2017 15:43:30 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2017 06:43:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,418,1500966000"; d="scan'208";a="1173761841" Received: from unknown (HELO Sent) ([10.103.102.81]) by orsmga001.jf.intel.com with SMTP; 19 Sep 2017 06:43:27 -0700 Received: by Sent (sSMTP sendmail emulation); Tue, 19 Sep 2017 15:34:36 +0200 From: Daniel Mrzyglod To: thomas@monjalon.net Cc: dev@dpdk.org, Daniel Mrzyglod Date: Tue, 19 Sep 2017 15:34:32 +0200 Message-Id: <20170919133432.6437-1-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.13.5 Subject: [dpdk-dev] [PATCH] eal: fix resource leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Sep 2017 13:43:31 -0000 Memory allocated in strdup is not free. Coverity issue: 143257 Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id") Cc: thomas@monjalon.net Signed-off-by: Daniel Mrzyglod --- lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 48f12f4..1bdbc3f 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -781,6 +781,7 @@ rte_eal_init(int argc, char **argv) if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; + free(logid); return -1; } @@ -789,6 +790,7 @@ rte_eal_init(int argc, char **argv) rte_eal_init_alert("Invalid 'command line' arguments."); rte_errno = EINVAL; rte_atomic32_clear(&run_once); + free(logid); return -1; } @@ -799,6 +801,7 @@ rte_eal_init(int argc, char **argv) rte_eal_init_alert("Cannot get hugepage information."); rte_errno = EACCES; rte_atomic32_clear(&run_once); + free(logid); return -1; } @@ -826,6 +829,7 @@ rte_eal_init(int argc, char **argv) rte_eal_init_alert("Cannot init logging."); rte_errno = ENOMEM; rte_atomic32_clear(&run_once); + free(logid); return -1; } @@ -834,6 +838,7 @@ rte_eal_init(int argc, char **argv) rte_eal_init_alert("Cannot init VFIO\n"); rte_errno = EAGAIN; rte_atomic32_clear(&run_once); + free(logid); return -1; } #endif @@ -841,6 +846,7 @@ rte_eal_init(int argc, char **argv) if (rte_eal_memory_init() < 0) { rte_eal_init_alert("Cannot init memory\n"); rte_errno = ENOMEM; + free(logid); return -1; } @@ -850,24 +856,28 @@ rte_eal_init(int argc, char **argv) if (rte_eal_memzone_init() < 0) { rte_eal_init_alert("Cannot init memzone\n"); rte_errno = ENODEV; + free(logid); return -1; } if (rte_eal_tailqs_init() < 0) { rte_eal_init_alert("Cannot init tail queues for objects\n"); rte_errno = EFAULT; + free(logid); return -1; } if (rte_eal_alarm_init() < 0) { rte_eal_init_alert("Cannot init interrupt-handling thread\n"); /* rte_eal_alarm_init sets rte_errno on failure. */ + free(logid); return -1; } if (rte_eal_timer_init() < 0) { rte_eal_init_alert("Cannot init HPET or TSC timers\n"); rte_errno = ENOTSUP; + free(logid); return -1; } @@ -886,17 +896,20 @@ rte_eal_init(int argc, char **argv) if (rte_eal_intr_init() < 0) { rte_eal_init_alert("Cannot init interrupt-handling thread\n"); + free(logid); return -1; } if (eal_option_device_parse()) { rte_errno = ENODEV; + free(logid); return -1; } if (rte_bus_scan()) { rte_eal_init_alert("Cannot scan the buses for devices\n"); rte_errno = ENODEV; + free(logid); return -1; } @@ -941,6 +954,7 @@ rte_eal_init(int argc, char **argv) if (ret) { rte_eal_init_alert("rte_service_init() failed\n"); rte_errno = ENOEXEC; + free(logid); return -1; } @@ -948,6 +962,7 @@ rte_eal_init(int argc, char **argv) if (rte_bus_probe()) { rte_eal_init_alert("Cannot probe devices\n"); rte_errno = ENOTSUP; + free(logid); return -1; } @@ -957,6 +972,7 @@ rte_eal_init(int argc, char **argv) ret = rte_service_start_with_defaults(); if (ret < 0 && ret != -ENOTSUP) { rte_errno = ENOEXEC; + free(logid); return -1; } -- 2.7.4