From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 19DFE3B5 for ; Sat, 28 Feb 2015 01:51:28 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 27 Feb 2015 16:47:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,664,1418112000"; d="scan'208";a="684637932" Received: from kmsmsx151.gar.corp.intel.com ([172.21.73.86]) by fmsmga002.fm.intel.com with ESMTP; 27 Feb 2015 16:51:26 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by KMSMSX151.gar.corp.intel.com (172.21.73.86) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 28 Feb 2015 08:51:25 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.62]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.46]) with mapi id 14.03.0195.001; Sat, 28 Feb 2015 08:51:23 +0800 From: "Ouyang, Changchun" To: Neil Horman Thread-Topic: [dpdk-dev] [PATCH v2] af_packet: Fix some klocwork errors Thread-Index: AQHQUic7A3G+EhjYrEWCM4YIoWk1pJ0EAjKAgAE6k6A= Date: Sat, 28 Feb 2015 00:51:23 +0000 Message-ID: References: <1424932947-14750-1-git-send-email-changchun.ouyang@intel.com> <1424998153-22718-1-git-send-email-changchun.ouyang@intel.com> <20150227140431.GC1611@hmsreliant.think-freely.org> In-Reply-To: <20150227140431.GC1611@hmsreliant.think-freely.org> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2] af_packet: Fix some klocwork errors 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: Sat, 28 Feb 2015 00:51:29 -0000 > -----Original Message----- > From: Neil Horman [mailto:nhorman@tuxdriver.com] > Sent: Friday, February 27, 2015 10:05 PM > To: Ouyang, Changchun > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] af_packet: Fix some klocwork errors >=20 > On Fri, Feb 27, 2015 at 08:49:13AM +0800, Ouyang Changchun wrote: > > Fix possible memory leak issue: free kvlist before return; Fix > > possible resource lost issue: close qssockfd before return; > > > > Signed-off-by: Changchun Ouyang > > --- > > change in v2: > > - Make the error exit point a common path. > > > > lib/librte_pmd_af_packet/rte_eth_af_packet.c | 11 +++++++++-- > > 1 file changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > index 80e9bdf..c675724 100644 > > --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c > > @@ -694,6 +694,8 @@ error: > > } > > rte_free(*internals); > > } > > + if (qsockfd !=3D -1) > > + close(qsockfd); > This is insufficient. qsockfd is a loop index that is reassigned for eac= h tx > queue we have. In the error path you need to do this, and loop through t= he > tx queues, closing each tx_queue->sockfd. >=20 Thanks, will have a v3 to resolve it. Changchun