From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id F12C158EB for ; Thu, 30 Jan 2014 12:21:46 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 30 Jan 2014 03:23:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,749,1384329600"; d="scan'208";a="473182521" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by fmsmga002.fm.intel.com with ESMTP; 30 Jan 2014 03:23:03 -0800 Received: from irsmsx106.ger.corp.intel.com (163.33.3.31) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 30 Jan 2014 11:22:43 +0000 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.84]) by IRSMSX106.ger.corp.intel.com ([169.254.8.96]) with mapi id 14.03.0123.003; Thu, 30 Jan 2014 11:22:43 +0000 From: "Richardson, Bruce" To: Olivier Matz , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 05/11] kvargs: rework API to fix memory leak Thread-Index: AQHPHEM11Wr/Wo5AAU2WvNNLDlOObpqdIoMA Date: Thu, 30 Jan 2014 11:22:42 +0000 Message-ID: <59AF69C657FD0841A61C55336867B5B01A995F9F@IRSMSX103.ger.corp.intel.com> References: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com> <1390925204-10800-6-git-send-email-olivier.matz@6wind.com> In-Reply-To: <1390925204-10800-6-git-send-email-olivier.matz@6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 05/11] kvargs: rework API to fix memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jan 2014 11:21:47 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Olivier Matz > Sent: Tuesday, January 28, 2014 4:07 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 05/11] kvargs: rework API to fix memory leak >=20 > Before the patch, a call to rte_kvargs_tokenize() resulted in a call to > strdup() to allocate a modifiable copy of the argument string. This strin= g > was never freed, excepted in the error cases of > rte_kvargs_tokenize() where rte_free() was wrongly called instead of free= (). > In other cases, freeing this string was impossible as the pointer not sav= ed. >=20 > This patch introduces rte_kvargs_free() in order to free the structure > properly. The pointer to the duplicated string is now kept in the rte_kva= rgs > structure. A call to rte_kvargs_parse() directly allocates the structure, > making rte_kvargs_init() useless. >=20 > The only drawback of this API change is that a key/value associations > cannot be added to an existing kvlist. But it's not used today, and there= is > not obvious use case for that. >=20 > Signed-off-by: Olivier Matz > --- > lib/librte_kvargs/Makefile | 3 +- > lib/librte_kvargs/rte_kvargs.c | 64 ++++++++++++++++++--------------= ------ > lib/librte_kvargs/rte_kvargs.h | 42 +++++++++++-------------- > lib/librte_pmd_pcap/rte_eth_pcap.c | 27 ++++++++-------- > 4 files changed, 63 insertions(+), 73 deletions(-) >=20 Acked-by: Bruce Richardson