From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 81FE41B225 for ; Mon, 2 Oct 2017 16:16:33 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Oct 2017 07:16:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,469,1500966000"; d="scan'208";a="134335891" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga004.jf.intel.com with ESMTP; 02 Oct 2017 07:16:31 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.28]) by IRSMSX106.ger.corp.intel.com ([169.254.8.36]) with mapi id 14.03.0319.002; Mon, 2 Oct 2017 15:16:30 +0100 From: "Jastrzebski, MichalX K" To: "Mrzyglod, DanielX T" , "thomas@monjalon.net" CC: "dev@dpdk.org" , "Mrzyglod, DanielX T" Thread-Topic: [dpdk-dev] [PATCH v2] eal: fix resource leak Thread-Index: AQHTM7HxOR3rPTMz/0m1UbvwZ4GUkaLQqm+A Date: Mon, 2 Oct 2017 14:16:29 +0000 Message-ID: <60ABE07DBB3A454EB7FAD707B4BB158213C40FB0@IRSMSX109.ger.corp.intel.com> References: <20170919133432.6437-1-danielx.t.mrzyglod@intel.com> <20170922144820.16590-1-danielx.t.mrzyglod@intel.com> In-Reply-To: <20170922144820.16590-1-danielx.t.mrzyglod@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjdiNmM4NTItNzg2Ny00Y2ZjLWE5NTItNzI0ZGUwMzhlYzkzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkJIbFhLWmhKVG9qNFIwc0FPZmNCRDVyM0JFZ1Z3N3pXMXdwMURtS001YXc9In0= x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] 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: Mon, 02 Oct 2017 14:16:34 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod > Sent: Friday, September 22, 2017 4:48 PM > To: thomas@monjalon.net > Cc: dev@dpdk.org; Mrzyglod, DanielX T > Subject: [dpdk-dev] [PATCH v2] eal: fix resource leak >=20 > Memory allocated in strdup is not free. >=20 > Coverity issue: 143257 > Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id") > Cc: thomas@monjalon.net >=20 > Signed-off-by: Daniel Mrzyglod > --- > v2: > * Fix due to compilation errors >=20 > lib/librte_eal/linuxapp/eal/eal.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal.c > b/lib/librte_eal/linuxapp/eal/eal.c > index 48f12f4..a7df566 100644 > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -751,7 +751,7 @@ rte_eal_init(int argc, char **argv) > int i, fctret, ret; > pthread_t thread_id; > static rte_atomic32_t run_once =3D RTE_ATOMIC32_INIT(0); > - const char *logid; > + char *logid; > char cpuset[RTE_CPU_AFFINITY_STR_LEN]; > char thread_name[RTE_MAX_THREAD_NAME_LEN]; >=20 > @@ -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 =3D ENOTSUP; > + free(logid); > return -1; > } >=20 > @@ -789,6 +790,7 @@ rte_eal_init(int argc, char **argv) > rte_eal_init_alert("Invalid 'command line' arguments."); > rte_errno =3D EINVAL; > rte_atomic32_clear(&run_once); > + free(logid); > return -1; > } >=20 > @@ -799,6 +801,7 @@ rte_eal_init(int argc, char **argv) > rte_eal_init_alert("Cannot get hugepage information."); > rte_errno =3D EACCES; > rte_atomic32_clear(&run_once); > + free(logid); > return -1; > } >=20 > @@ -826,6 +829,7 @@ rte_eal_init(int argc, char **argv) > rte_eal_init_alert("Cannot init logging."); > rte_errno =3D ENOMEM; > rte_atomic32_clear(&run_once); > + free(logid); > return -1; > } >=20 > @@ -834,6 +838,7 @@ rte_eal_init(int argc, char **argv) > rte_eal_init_alert("Cannot init VFIO\n"); > rte_errno =3D 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 =3D ENOMEM; > + free(logid); > return -1; > } >=20 > @@ -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 =3D ENODEV; > + free(logid); > return -1; > } >=20 > if (rte_eal_tailqs_init() < 0) { > rte_eal_init_alert("Cannot init tail queues for objects\n"); > rte_errno =3D EFAULT; > + free(logid); > return -1; > } >=20 > 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; > } >=20 > if (rte_eal_timer_init() < 0) { > rte_eal_init_alert("Cannot init HPET or TSC timers\n"); > rte_errno =3D ENOTSUP; > + free(logid); > return -1; > } >=20 > @@ -886,17 +896,20 @@ rte_eal_init(int argc, char **argv) >=20 > if (rte_eal_intr_init() < 0) { > rte_eal_init_alert("Cannot init interrupt-handling > thread\n"); > + free(logid); > return -1; > } >=20 > if (eal_option_device_parse()) { > rte_errno =3D ENODEV; > + free(logid); > return -1; > } >=20 > if (rte_bus_scan()) { > rte_eal_init_alert("Cannot scan the buses for devices\n"); > rte_errno =3D ENODEV; > + free(logid); > return -1; > } >=20 > @@ -941,6 +954,7 @@ rte_eal_init(int argc, char **argv) > if (ret) { > rte_eal_init_alert("rte_service_init() failed\n"); > rte_errno =3D ENOEXEC; > + free(logid); > return -1; > } >=20 > @@ -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 =3D ENOTSUP; > + free(logid); > return -1; > } >=20 > @@ -957,6 +972,7 @@ rte_eal_init(int argc, char **argv) > ret =3D rte_service_start_with_defaults(); > if (ret < 0 && ret !=3D -ENOTSUP) { > rte_errno =3D ENOEXEC; > + free(logid); > return -1; > } >=20 > -- > 2.7.4 Hi Thomas, I would like to ask for a feedback regarding proposed fix. If everything is ok with it, please send acked-by. Best regards Michal.