From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7946DA0C4F; Thu, 15 Jul 2021 03:42:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F017F4014D; Thu, 15 Jul 2021 03:42:49 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id E8EA940143; Thu, 15 Jul 2021 03:42:47 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10045"; a="274285058" X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="274285058" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2021 18:42:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="571508536" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga001.fm.intel.com with ESMTP; 14 Jul 2021 18:42:46 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 14 Jul 2021 18:42:45 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Wed, 14 Jul 2021 18:42:45 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Wed, 14 Jul 2021 18:42:45 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.42) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Wed, 14 Jul 2021 18:42:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HABjh21Ia6sGaSr8GWsSsCrzN7CyRjUmxqFzxFAmxNNnije07vktMwKRW5/qDm22R0HWmSp6HDrhBRWYcfZOVn7PoNmxTgWYPntoRu8fiG/7V+kBNhnnXhcmuz7eWTN55eZsxkK+pubt7zIuDe8WJ4hPP7c8D7/CxxzqqFWk/LYbauLW8r8hDsFo1vY5hHPIhAUa6ccm57N9HBZZ//93jYaqyRWx/v26eIensIMoKbnbeQM2X5NjE47vlfPU7Lr3iT+nCG9t0I2R7Ty3lBStIJjetlCW6Nz2f9zQ8Iqnoer/CQ8DKkvmjUDaIW5z5NcoPu/N0EownY5ZTLcifnKdAw== 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=4phyqxtnWb7CwTCjDapYk56xeSll95NBbDS5aaSErhY=; b=nRFy2AwbIf4O5M5IMo1q8RaNKTRohGWxrsNPkoyU2eFE+B6InFvUBJ+k5RgawHgRRO4CTG4Ww3Uys/HDD3g3LxWv63qF6V6G5lPh0YjoGm/r1jBEMvVxd6v1vJHRYVkMKmg/f50FbOk53/bcp3NSJkAcgXB4lr6VEKIti46+bt58DfsPC3Z2NV4kUpR98/LRzmkqnPUeEHEN1HlmLAwc/VjNKtWs9Tg9MyWQxPNBlP0CyqplBnrArev365jJ3JUjIBkFTlrNWYwnvs8kGKgd3GJ1gRynsj3vVIWVCa6zEcM+HY5md5xjBpMUgcumdz3lxCaVbnsUwhTYG0apQ1mwlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4phyqxtnWb7CwTCjDapYk56xeSll95NBbDS5aaSErhY=; b=yL8KhlgCLgErxcdCvp2fDifZILjIxzkcbYU5ae//n6kMCYFanhks/Hlt0iZv9zLxEyHjqZKEPA+ed9gZNrjA+jsvXyWPNvgNgErjUdXEdd2PWiKX5Rq9SYZ/iPsXV3ai0ytJdgWRTmf5H9GsyhVsTeVlq6gYRWdg93eBwf0IUfU= Received: from PH0PR11MB5125.namprd11.prod.outlook.com (2603:10b6:510:3e::15) by PH0PR11MB4855.namprd11.prod.outlook.com (2603:10b6:510:41::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.23; Thu, 15 Jul 2021 01:42:43 +0000 Received: from PH0PR11MB5125.namprd11.prod.outlook.com ([fe80::a86f:e259:e7c4:7a67]) by PH0PR11MB5125.namprd11.prod.outlook.com ([fe80::a86f:e259:e7c4:7a67%6]) with mapi id 15.20.4308.027; Thu, 15 Jul 2021 01:42:43 +0000 From: "Yu, DapengX" To: "Singh, Jasvinder" , "Dumitrescu, Cristian" CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH v3] net/softnic: fix memory leak in parsing arguments Thread-Index: AQHXeHPLBhsLqq0XYk+GSwRMiAG34qtCT/gAgADyOjA= Date: Thu, 15 Jul 2021 01:42:43 +0000 Message-ID: References: <20210713100801.597956-1-dapengx.yu@intel.com> <20210714054702.764366-1-dapengx.yu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 90fa54e6-34f9-442f-5f31-08d94731d70e x-ms-traffictypediagnostic: PH0PR11MB4855: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: S1D8Ev3dIasGXAfXr+0cQeEv2ni0DQeEU52C5DLlywz2QBo2cTRzL46CrThmSHve/Uft8LnNQrxONu1VMSoVC0lq9DlDiG+pMxhSUhUvkYMJ7SsjCDQCp4ySTUyjt++F9Y1aKSYXmK8LJ2jV3ISrAVHEbCdWH/RFN+sMF+vZ6vxxbnn9qXj8iG4Uet0+QEqCEf9+MnYEZhbwJew+PisJNrqHYFDJrCR+sLtkBlBo/pJG8hzeGRHmjS6ZBN0xxCE4YEhFbGqvXKE9b2XgLOBVHONtM54K3u7giYLSRyfBVo/VI5CAcAvZyhHLLfAM72tf+hQQmJaqP0cetKnIlAbS7X8EVyrqkA56p+69nLk3+W+c1J/zyT1fgr5tvjK2HAy296TbCU6wwasLjp7zCAqs2kr/3cWZLZsOa1NpBl0ig31A83npwzovV9YUDCrk8E2Xrz3BjTqhF1HXc0ZHt5wRkZt46Z4GKqivIFTw3NnYACHUhx4lhzYKlI9c4jGj3J4PeAfoP6NGOWgv7nsrTvE9HOLA8MZItD+LRvy8HtGb+HhTkXAKrlxye5WPFCMYuXuKzOUJlM1ZXCmvGvh6gegixLaiu6IFBTK8RvxoYJopX2FP5KDhtHWSkVLfyoxK0O9op83rmHCm6/oC1rx7ldi0PRauf3u10smvY/aVp7HYpE/Af9zR2NDxixpS/USlPMT+9pPSERHpI3NIR4dEcfjYPQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5125.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(136003)(39860400002)(376002)(396003)(346002)(66556008)(64756008)(71200400001)(5660300002)(2906002)(316002)(66446008)(66946007)(9686003)(8936002)(8676002)(66476007)(54906003)(38100700002)(110136005)(33656002)(4326008)(450100002)(7696005)(55016002)(52536014)(86362001)(6636002)(122000001)(186003)(6506007)(26005)(53546011)(76116006)(83380400001)(478600001)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8WB0RCYj7S8UaPRzi1j/tjZVGuiF/oG6WNRNWmQ1CaAAsIxEW+/0C8RWHGcR?= =?us-ascii?Q?KlYCgQGaKKb9QeV0Ju/gBm0G59Ja+VPYL2CXEOZWyp1iPqaJyMCKSd48iAaa?= =?us-ascii?Q?bPDmi8GvJQaMvOIGBXAZpRr1VP2+atEODqFSb35sklOLzrIMFN4Qsw+jvGWs?= =?us-ascii?Q?dK77tzCFJwBqojYdxYaNDVTcRg7mv+i1aYe8rCxaVmWG6VEk8IViW4VXsxQK?= =?us-ascii?Q?qN66b2FxRYlqHi4+Zx0gqcauW2zRON3SHQ/RZp135h8EEUnuQYIC7ZuVStmf?= =?us-ascii?Q?vh2Fxb54ottt12MFVZXtemwbRa4l/SBw6U4Z4EfkgLpEn+hrnD7Hoo312Cxm?= =?us-ascii?Q?ZW882PpVEw4flTYfC2KnIfjjGpw/fkXD9YW4OFbVqDI25KRgZ/XrlPSld2qX?= =?us-ascii?Q?2g9SBbAJWHd0VOgm/C2klWNtR5khfnwZj0uzKl6fqS96TWsJ8Ah9wh4krkcJ?= =?us-ascii?Q?BTzxKAe7jYAOO7iis0/T6yGMyfA7/RZNdNf1tef6Dj7ZFfd03RAJgtbf4TzO?= =?us-ascii?Q?VafQ7ZjvEvPLDQ1iMJPw2oWYezibF5LfWa5IFke93dvF1/k8CoRkHHfWdhnb?= =?us-ascii?Q?yzznEGK5HgDo9kP+maejZyHKwkFjpM99eGaenz48lqLcv6i6BEA0kqvyYxuD?= =?us-ascii?Q?LUOjufx0GvxUNxXldv2K/Rw2kSkvUQMPB5Xmr1m/ya5zFdDQfR+ak5m847mb?= =?us-ascii?Q?eCo1cItZQE/mRHwT/udFOmvhHLuri5J8J111wHFiSksxAxDSulDZrf7uj20C?= =?us-ascii?Q?wurmZrbA1K2ZXHGYOsAjH6bMwDwkCPkZMTMLPaRakZG6CQ+ONpxoRZmRSDOd?= =?us-ascii?Q?da84rESWVCjw8p4DtIfVyoiH61pBjZny6c9u5sowrnQsKzSTbhm5GNS+WR+M?= =?us-ascii?Q?vssfwmq4iefjEjNWEFjL/MM5NsBoAfVmXJOWyha21pIu54bHFQEYzmFcHmpj?= =?us-ascii?Q?PUa3/VRLfEpyt3Z5ENXjtGImHsLS/flMmEuW38d+p9GFDLGBn87s504XxaRG?= =?us-ascii?Q?NT8nfkN0ZFdjbiBcjSPIk2sFu/j1+qg6Ged+h0IxUcUmtUgU0mVgCeF5u8BF?= =?us-ascii?Q?fgcmzDiF44+s5q/MK9o6Dy9gu5jhnHsEcYhNQTgXjHuXrtHaWdL1UA9e9+zQ?= =?us-ascii?Q?JmiSLbrbXLKP1B5pnlHzD2gPkCL/8PeTFXU/svoqzm74YbkP0wyZ2eZ40aSA?= =?us-ascii?Q?cFhwSJvd3OUlAFYFfyBYd8ynTyQRhTXuE+LiplEmJsCexa/I+Jy4kiSVUWpU?= =?us-ascii?Q?YE2o6Xh+WDsQRi3yIgZ4JJRSlnycmI/vRp77JoAuhUhIW9xUiNDH/ezRrUZP?= =?us-ascii?Q?Whw=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5125.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90fa54e6-34f9-442f-5f31-08d94731d70e X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2021 01:42:43.5404 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TUtYIvRhutoALZ4Vw7/s1D9iZR7P6eGXlGTQt8+mY6oVtYmhbebqZrMmltmf5t01+ZAKQa+CWf9LMFkaRSePog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4855 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3] net/softnic: fix memory leak in parsing arguments X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" > -----Original Message----- > From: Singh, Jasvinder > Sent: Wednesday, July 14, 2021 7:08 PM > To: Yu, DapengX ; Dumitrescu, Cristian > > Cc: dev@dpdk.org; stable@dpdk.org > Subject: RE: [PATCH v3] net/softnic: fix memory leak in parsing arguments >=20 > >=20 > > + free(firmware); >=20 > Memory for firmware is not allocated dynamically, so no need for this. I have double checked it, at this code snippet, the memory block referenced= by the "firmware" pointer is allocated by the strdup() in get_string() fun= ction. The free(firmware) is necessary, and it prevents memory leak. >=20 > >=20 > > struct pmd_params { > > - const char *name; > > - const char *firmware; > > + char name[RTE_DEV_NAME_MAX_LEN]; >=20 > Please replace " RTE_DEV_NAME_MAX_LEN " with "NAME_SIZE" which is > already defined in softnic_internals.h It will be modified in the next version. >=20 > > + char firmware[PATH_MAX]; >=20 > Also, instead of using PATH_MAX, define new macro "SOFTNIC_PATH_MAX > 4096" in softnic_internals.h It will be modified in the next version. >=20 >=20 > > uint16_t conn_port; > > uint32_t cpu_id; > > int sc; /**< Service cores. */ > > -- > > 2.27.0