From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 39156A2F18 for ; Thu, 3 Oct 2019 10:40:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F38C61C01B; Thu, 3 Oct 2019 10:40:04 +0200 (CEST) Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30048.outbound.protection.outlook.com [40.107.3.48]) by dpdk.org (Postfix) with ESMTP id 8F2391C013; Thu, 3 Oct 2019 10:40:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDxw1FZh4Yj7SobyU56hqeFBijoTMk6tX0WxIUkgoJExNWJTr5pgt/Bly2qaQNjrEi8YV/y8i9DZIkCLcnyV7oILVtSJw+Ex/TZu+cGNeUhZfqz7N8xUz1mrvrdTjs264D/LnlettwdEGbhDG68Ce0Yt0GFepcLgszVaaJWmm5EoifacXGhLxNPVi03WxXTu7FYviCxqudPVl0c9sDz4pO474VcCNUeqSjcJUuIqQJXjk3V/H+VzvVRcfrydVYoNgL9wAWVv4R4ZwTH3lydg7Z8SoqyUAmOfn4MFXA8k2o8bhbCRxa6TtK5UDgwKklaZFs46o2vih8xqanR3PWJn6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GSOSY+hogpXwo8vEtZDqZyFhg2QcGKz77sGMuQXrBUI=; b=fkjejlZliRRSJRC+ZB8SOwe935sokGmq+4jrbINGoCiFEvkno1/V2zKRSfh2iur0MLSLO0Ylq5Ym7gB5r4RHzJI9OlVxLyMBAjnas2rQNFINazHH61n8OyUhN8PM9j6hDJ5hTcb8YqKRQkRbLzqVUAFx4hq256YcXPxKAJh2RNVLG+4LfQLoSTkw9+JJZvjwUorhwP7c7SD3olI6nbxcERxzOhvpoLib/fgHrqmVEUk/T8Gu+l5ZZQ2Y8w+HIUoi8jt4cN93XYUIxQhWkYpJx5gWce9FEtt+7ndqW4K78mvWcyfEagssfYZ/zQmWJtxq6kjhY9eVexuC1oxNvxzNHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GSOSY+hogpXwo8vEtZDqZyFhg2QcGKz77sGMuQXrBUI=; b=iNWEADzMCq68Vl+e6sxG0lx5whZA/eWFibROrSOBPjn2sdVjG6wVAJPVK73JwLV0MsqNBSxt74jvp+DKQUT4hQGg+7dWOtqupOCdXN+Ikn8B6blBvpoeJKIH1VV9bXDAaRk+aBAKDEXdhGqWiSNacv3uq7rGZjDa04ugfDLYFlk= Received: from VI1PR04MB4845.eurprd04.prod.outlook.com (20.177.49.14) by VI1PR04MB4319.eurprd04.prod.outlook.com (52.134.122.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.17; Thu, 3 Oct 2019 08:40:02 +0000 Received: from VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::fc3a:34f2:36f3:bea4]) by VI1PR04MB4845.eurprd04.prod.outlook.com ([fe80::fc3a:34f2:36f3:bea4%3]) with mapi id 15.20.2305.023; Thu, 3 Oct 2019 08:40:02 +0000 From: Sachin Saxena To: Agalya Babu RadhaKrishnan , "dev@dpdk.org" CC: "reshma.pattan@intel.com" , Hemant Agrawal , "jananeex.m.parthasarathy@intel.com" , "stable@dpdk.org" Thread-Topic: [PATCH] bus/fslmc: fix for resource leak coverity issue Thread-Index: AQHVZ6n/YM2SoP9j/kaoM+MIMDGptqdIvMVQ Date: Thu, 3 Oct 2019 08:40:02 +0000 Message-ID: References: <1568100655-20010-1-git-send-email-agalyax.babu.radhakrishnan@intel.com> In-Reply-To: <1568100655-20010-1-git-send-email-agalyax.babu.radhakrishnan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sachin.saxena@nxp.com; x-originating-ip: [92.120.1.72] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 69590389-8d0a-4a30-864f-08d747dd4883 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: VI1PR04MB4319:|VI1PR04MB4319: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 01792087B6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(136003)(376002)(396003)(366004)(39860400002)(189003)(199004)(13464003)(229853002)(486006)(66446008)(478600001)(76176011)(74316002)(64756008)(66476007)(66556008)(66946007)(76116006)(476003)(8936002)(44832011)(66066001)(446003)(7696005)(99286004)(53546011)(11346002)(6506007)(25786009)(9686003)(26005)(86362001)(33656002)(81156014)(8676002)(81166006)(2501003)(14454004)(5660300002)(186003)(256004)(6246003)(14444005)(54906003)(4326008)(305945005)(110136005)(102836004)(7736002)(6436002)(316002)(71190400001)(71200400001)(52536014)(2906002)(3846002)(6116002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB4319; H:VI1PR04MB4845.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: L9P7G9FVWA2SWc3gUc+ShJEy3ySQ5cWEjWYbpYOltN45jL4nLiueRiaYKxRMHzlATse3uQGdk+1f9sejjsxzeJevVdy7SXIl9IfnLGIlOiHmuTUG7Beib7/H0Qt5mNNe7b8sTQFtqQv2XKFoM5UmxoKTAt60TBlz9SjT1qlSIy/BkCtOTVPIOCL3jzyeQxukH2sYVx/r3O6Mrmbr9tCCjGk6nSb0C3SByt40L5dix5Zr92ZR9wnMtTWAPFSjH3mBGT4fg5/gwWp/oPtw3HwVC8vrlJpRWZmmVDI+vgmipItgFKbBf3QqHzndbZNclTr0cjX1ft8Uh4An7LtYxaJtHHxBX63VdcUPa1HY7P2LmSBxggLgNcFgkjhC62V/oMGBeQvexv2W7Yrpw0sN5JUrmYJm7PQafNQP/3LHoOfNRcA= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69590389-8d0a-4a30-864f-08d747dd4883 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2019 08:40:02.5658 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JfwICHYNLH22Gh6Be6ARKTgNSZMomHW94zF0sw61oh7mitN8ukvsqpORmRQlsYNuNUKj+SdzadGa8TaUY9weBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4319 Subject: Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Acked-by: Sachin Saxena regards, Sachin Saxena > -----Original Message----- > From: Agalya Babu RadhaKrishnan > Sent: Tuesday, September 10, 2019 1:01 PM > To: dev@dpdk.org > Cc: reshma.pattan@intel.com; Hemant Agrawal > ; Sachin Saxena ; > jananeex.m.parthasarathy@intel.com; Agalya Babu RadhaKrishnan > ; stable@dpdk.org > Subject: [PATCH] bus/fslmc: fix for resource leak coverity issue > Importance: High >=20 > From: Agalya Babu RadhaKrishnan >=20 > 1 issue caught by 344967 > Leaked_storage: Variable sep going out of scope leaks the storage it poin= ts > to. >=20 > When 'sep' is not null and sep_exist is 0, 'sep' is freed before going ou= t of > scope of the function irrespective of 'addr' exists or not. >=20 > Coverity Issue: 344967 > Fixes: e67a61614d0b ("bus/fslmc: support device iteration") > Cc: stable@dpdk.org >=20 > Signed-off-by: Agalya Babu RadhaKrishnan > > --- > drivers/bus/fslmc/fslmc_bus.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.= c > index a2f482516..60c34098c 100644 > --- a/drivers/bus/fslmc/fslmc_bus.c > +++ b/drivers/bus/fslmc/fslmc_bus.c > @@ -291,10 +291,13 @@ rte_fslmc_parse(const char *name, void *addr) > goto err_out; > } >=20 > - if (addr) > + if (addr) { > strcpy(addr, sep); > + if (!sep_exists && sep) > + free(sep); > + return 0; > + } >=20 > - return 0; > err_out: > if (!sep_exists && sep) > free(sep); > -- > 2.14.1