From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E81756CC4 for ; Thu, 19 Apr 2018 10:37:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2018 01:37:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,468,1517904000"; d="scan'208";a="49101370" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga001.jf.intel.com with ESMTP; 19 Apr 2018 01:37:08 -0700 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.176]) by IRSMSX154.ger.corp.intel.com ([169.254.12.234]) with mapi id 14.03.0319.002; Thu, 19 Apr 2018 09:37:07 +0100 From: "Singh, Jasvinder" To: "Pattan, Reshma" , "dev@dpdk.org" Thread-Topic: [PATCH] examples/ip_pipipeline: fix resource leak Thread-Index: AQHT1zaP8sTyE01yWkKj+eFkNFqamaQHxLfA Date: Thu, 19 Apr 2018 08:37:07 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D33341990@IRSMSX101.ger.corp.intel.com> References: <1524070690-12000-1-git-send-email-reshma.pattan@intel.com> <1524070690-12000-3-git-send-email-reshma.pattan@intel.com> In-Reply-To: <1524070690-12000-3-git-send-email-reshma.pattan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTA3NDc3NjQtNDk1Ni00YzJjLTljMmEtMDc0NDZmMWQ4YjkxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IjhZcVk3Y3p1NDRuUDFtY0xhSW1IblVYOEFXZmJWME1XZFJXbndTcHlZRk09In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 dlp-reaction: no-action 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] examples/ip_pipipeline: 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: Thu, 19 Apr 2018 08:37:11 -0000 > -----Original Message----- > From: Pattan, Reshma > Sent: Wednesday, April 18, 2018 5:58 PM > To: dev@dpdk.org > Cc: Singh, Jasvinder ; Pattan, Reshma > > Subject: [PATCH] examples/ip_pipipeline: fix resource leak >=20 > Close tap device fd before returning upon failures. >=20 > Coverity issue: 272576 > Fixes: 2f74ae28e2 ("examples/ip_pipeline: add tap object") > CC: jasvinder.singh@intel.com >=20 > Signed-off-by: Reshma Pattan > --- > examples/ip_pipeline/tap.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) >=20 > diff --git a/examples/ip_pipeline/tap.c b/examples/ip_pipeline/tap.c inde= x > 5b3403218..a0f60867f 100644 > --- a/examples/ip_pipeline/tap.c > +++ b/examples/ip_pipeline/tap.c > @@ -76,14 +76,17 @@ tap_create(const char *name) > snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name); >=20 > status =3D ioctl(fd, TUNSETIFF, (void *) &ifr); > - if (status < 0) > + if (status < 0) { > + close(fd); > return NULL; > + } >=20 > /* Node allocation */ > tap =3D calloc(1, sizeof(struct tap)); > - if (tap =3D=3D NULL) > + if (tap =3D=3D NULL) { > + close(fd); > return NULL; > - > + } > /* Node fill in */ > strncpy(tap->name, name, sizeof(tap->name)); > tap->fd =3D fd; > -- > 2.14.3 Reviewed-by: Jasvinder Singh