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 25E2AA00C5; Wed, 2 Feb 2022 17:54:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B1058410DC; Wed, 2 Feb 2022 17:54:16 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id A4F69410D5 for ; Wed, 2 Feb 2022 17:54:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643820854; x=1675356854; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/Sqog2IyLHPtVX/i5/2ppZVsTHM/Iu+WtPK4CsH6UGo=; b=IzyE44HHnv5PbVCYu21y0cJ/7Oq6QNMfODUppjOpP7emdpbFVTplZ/D0 UCC+Wy7zafcC8LHq/LvLCgB1646htBHfhDmssNpd7IXwk1ZZmqCmU5DZ1 /XnhWYubINAxCOboML6fILn8SaNNUNmzkqottRja8diISWfHzyfKcsmZG UuBNfc6R+ti93p77Tzab9q8RMUU8tCcmbGbaj+JwyiqS/QtRUWnVtl0Qt iElt1YD+sihh72MS76lJnRomONgZCZv0to7PgfXmN6KObCASwJZljSYIg KMD+etGvu5q1Rmugj1zBhU4yJnh2jEPHhNNwvqXvrVM4hUKb6kLWFswpI g==; X-IronPort-AV: E=McAfee;i="6200,9189,10246"; a="235362157" X-IronPort-AV: E=Sophos;i="5.88,337,1635231600"; d="scan'208";a="235362157" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2022 08:47:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,337,1635231600"; d="scan'208";a="482888999" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga006.jf.intel.com with ESMTP; 02 Feb 2022 08:47:29 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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.2308.20; Wed, 2 Feb 2022 08:47:29 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 2 Feb 2022 08:47:29 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) 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.2308.20; Wed, 2 Feb 2022 08:47:28 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h62uvbgF3Mh72rp8wmbAFzPU04owgUJ2T4TV6y2Lzc9ZrryDJYL0+rHGQ78ULsVYME4a8+sx4oxPMK7Fe+ngljoe08Vp9/ZkOsL75PGGau/6lL94++58wMlXeFD1yBp0VkVnyjdUFDWU8Se459jaGjR9oZTfoYlXVgfACDey9k0g/jv4d2guEOQ59nwJTsu/NS0+QQ7uO9CjJ0IVoYWdTgTUx85NiHgRp6wW4WnUZbMsPMRl7cVtdWJcRROjO4yCgLkwyCBTQx/1nlpGTnDmLYslkhJM5MwKuIwHpnDfFw84DljYnCjqgmU14yvGaQb+gSPq9x89ibz+Ra3wa5ucqQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1vuzNaOKN5SgVUHQgwghB3We/INMv3D1dlZdagxj1B4=; b=mgZMx3qiUYIICtT//mZM3ayW1T8lslf6S8rWjZpYNond67SfkAp3zQAMQ7VR6bEEgxEYZiVfNJIRJXTUqoNQn8fFIrf1tnfAAtPgatfc+WqYTLCOfGXko4w6oDBg+j+gr7TeEFpjosQ4mm7lokMa5RF9RZUesBy7a5wC9zpn7bKyVkOsYE6iiGnOjACGHXfdQC92/3+De/MYURXUDjVb4MzUDFaN3LD2uGYbr4aS3YfN0saNxj/QTg7Idnff/2tYvWugiwUE7/0P7fTer7N/P0LZeF3ZcxnwWu/EhdU9xKuTPkB6M6en16x+TvGtuAGtyXjauUr5q0NwJ8HTn9q8NA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from MW4PR11MB5911.namprd11.prod.outlook.com (2603:10b6:303:16b::16) by SJ0PR11MB5598.namprd11.prod.outlook.com (2603:10b6:a03:304::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Wed, 2 Feb 2022 16:47:27 +0000 Received: from MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::e00c:1274:42e2:8355]) by MW4PR11MB5911.namprd11.prod.outlook.com ([fe80::e00c:1274:42e2:8355%7]) with mapi id 15.20.4930.021; Wed, 2 Feb 2022 16:47:27 +0000 From: "Kundapura, Ganapati" To: Weiguo Li , "Jayatheerthan, Jay" CC: "Naga Harish K, S V" , "dev@dpdk.org" Subject: RE: [PATCH v2] eventdev/eth_rx: fix memory leak when token parsing finished Thread-Topic: [PATCH v2] eventdev/eth_rx: fix memory leak when token parsing finished Thread-Index: AQHYGAg/1XAe+kVUJUiapfICqeBpRKx/4h2wgAB1OhCAACBqkA== Date: Wed, 2 Feb 2022 16:47:27 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 38a45bbb-0c37-4dd5-74f5-08d9e66bb22b x-ms-traffictypediagnostic: SJ0PR11MB5598:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:281; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RRQ3kB9rXxWhyFp0pv+Hc/hzZZmd0tGmM3kh5e2bnNocxcHGZO4hrkCAskmkTJFzrLVbECJ2BOPOrWOxSjuKVs3g8b/gB4rGENoSxVNBEflXC4nqiDqZZXAtURW4hO29bEA0SMxM+dW9tgRhVrzkD/o/ghSG0tog+taDYLN3dUA9jrlK7sdnRnjDYs2nJizCIWiQgRa+nYvBUzCWkFyPWgLfJOCuUhOTpcHrVAedaS6ROtGmTRxR+myyEzBUfAFqALHfxDfuQo2PoKSxNUkGxVpSNOIrwQf9H8XxTGcmTTCk/xbl+I1auUjAMs+cGvDGznCTE1359acU3HpuXY/1g8Hgf7lfjs2WTYKowz4Oj2YfYzkIrnjgsdu4k0skKbarcE2dgdmVhpSIhph2mHj2zcFMT6K0SUndF2liS688aOl0aFldT3Wj0XDAFUHq79jEzFqxRsoNoIbMVWLUHu5MI0V1tZrhinf5IkIdKgNxqqP1jmumR6i/s3d80c4QoFCoKLNSsMnuf7OfEspjkwCztNpkBEwIctFsIZpU3IAXTMpD2OnzCvRWCuqFDeO2Bbh+wk3JBPw9ItaAYygDDGrUm/fm7b9xP4rA+Iiqacmqut0ZpPDQvr5Tp/oRBXxAGOqrcIbHiQomTuTLnYGX/Hmkw34QtowzWaiilzZs4OEQK+o5YdFFz1fx+r0bqJzMIg9RPeeygUN9dSGVJ9Yr42Pgxg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5911.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(110136005)(8936002)(66446008)(8676002)(54906003)(66946007)(64756008)(66556008)(66476007)(6636002)(76116006)(316002)(38070700005)(86362001)(5660300002)(38100700002)(122000001)(4326008)(52536014)(82960400001)(83380400001)(508600001)(55016003)(55236004)(53546011)(26005)(186003)(7696005)(2940100002)(9686003)(6506007)(33656002)(71200400001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0LWoy5e2BKySKG6rNXYE4Beho560XYosCJbovP1CL9WWkuITwuHyjWbefaDJ?= =?us-ascii?Q?T4wjGD6PQsDzUaBF4VLjxy3JOkblr74YuveDk6+ObJERWNgsSoaJNsAMkSN0?= =?us-ascii?Q?2ZgRQVIAJyBhTU8R4alACgIcKZQpHTXAnYE5yd6E1r55rS9zXTogO2XKHjbo?= =?us-ascii?Q?QfNo850c7v2CClIbpms8hCWpihatIeSGgorV65ccMTSDj+Py2QYSPsaQTIMA?= =?us-ascii?Q?Fo1MxivDrFJF1DCXZBSmNI7krT3skj4yNWGYC/jWIfOz8JVDyZsNe7hycejb?= =?us-ascii?Q?AZPfEralK8VR/HRPZOe3G+4qVhFPoU6FoblCbcWrr9WWP+pga8ZPhTm9wq/P?= =?us-ascii?Q?Wysfe0+LFibYtrtrWzARmT9QKk4KG1vlhRNj+xZctFl1hQun1Nd7ZIMpCZiw?= =?us-ascii?Q?8icaxFnC8xvxM2yPefCQdOfjWBHXpyB5wPiJiry2SbuASMOkd0Gh8LSqd6do?= =?us-ascii?Q?wgGeUw4cOqVUVtx19/l+cgQYlriARj2IMS4AtHsIp5YdWdjxZvMah87VZO58?= =?us-ascii?Q?7x9y3fvWiKUYYmujSSzv/h0GoF+p4sq7gF0ZURkU6EyzKMlOHscjcARg8eiD?= =?us-ascii?Q?i/qdQHk5hHCRR5v5scrIxP/Q8etsoEyOCudt3mV/bbPLyV6WOZcJZv2/oyKC?= =?us-ascii?Q?l7FRFU2G1DbjE57yyIjcE43nxEm6ypVQyQX68DMWdB152vffkl1F+UaZMA1F?= =?us-ascii?Q?qwO3KMfXwBcxlU6JmuwzYZQoLx4BJxLlK5XwmCvhy3lzVQ0of5666RYbQl3Z?= =?us-ascii?Q?JGSwzNcrUIfTG1W6Uz3rOmaJdC4W/V2dgxVqcVRJQp/IbLeX6re7KFQlDEMm?= =?us-ascii?Q?JSelTAPh4MOkF7wWrzUagQQ8sgWjOve6nl6XrRhGL/1aRWXRS4e5HrK31/Bj?= =?us-ascii?Q?o0lUnp3uPI6easeBsohaaPPeS3ffsM1uhjddSFRn2N262sqzSJfcIEzIAX6m?= =?us-ascii?Q?gPJS/koXQh47AnQAN9hNpdR5Y4B+DS4tYHtbqxaQVz3gcMQgaRbgwdLsA7G2?= =?us-ascii?Q?q8s/D9uWTO6vJqClNXilay4zmP6onMuEdCm8g/7X1+qkm8FAvWzjLbfCl1L/?= =?us-ascii?Q?9VQAJ2FBQSB8drbvQOCfJ/7vRT/D8hcf0CUM6+9rwX2nFV0x453YfRa8wQCD?= =?us-ascii?Q?GV1hNzlCnjVa19LcRjowG25c3LMRNrdG4GL6XqF2aObzj7KYoOUf7tbIIlbN?= =?us-ascii?Q?mapJtSiP6U3JjFTYNB0Oz+Y9hUT8wUUr5Nl3ju1xf+bm56A6da5XkMwiPmSq?= =?us-ascii?Q?68Bs8F3Ia07Sp1JEW3XSJ2RSdPLEc4Z7N1gvVkxduw4r33AhcpdJiVbuND1I?= =?us-ascii?Q?LPv2cvCDWy1Dcijsv3YHdnpP64zH4T3xf2Yh3mtR5RcenQCuyK5tbj7PUseV?= =?us-ascii?Q?mnG/p69ioDn5Gwq4fDnfjrr/9eBQAtEQmH3+YXj2YIsSbWJch6EvgsjEWe9R?= =?us-ascii?Q?I3J8B0hpSpTfHAnS0TCU/yuj2c9mQbt5F2pcdUG7jGgqE05lXRNvT79b/ZeU?= =?us-ascii?Q?H04JqeueV78KoQbh3p/AC7GDWhlpFHzjyCkJph53j/yYlr8LTr0zKwJTXUP0?= =?us-ascii?Q?4o+v+NipGN22tgG7iNsZfyfRgANBMZ8RRtI5Unc8UNyBZWViLUiL88tq16jA?= =?us-ascii?Q?JN3mhpQvAew68ZSX0mDYLdXRt+cXjk0EiQ69sAJsd/7zBUh4Y5F/U3Z5s6d+?= =?us-ascii?Q?x1wDDQ=3D=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: MW4PR11MB5911.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 38a45bbb-0c37-4dd5-74f5-08d9e66bb22b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2022 16:47:27.3780 (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: n5eH2ypy5FClFp8Bz15Eq6pe2SIbigok6/lGsjKLO7NIQI+6M9fR46nuI0v9EwR5i7UbGQMEBIqV663iW/1sSqcagpybf6T1RSDEndFbVbg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5598 X-OriginatorOrg: intel.com 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 Hi Weiguo, Also noticed that usage of macros like RTE_EVENT_ETH_RX_ADAPTER_ID_VALID= _OR_ERR_RET and=20 RTE_ETH_VALID_PORTID_OR_ERR_RET to validate rx_adapter_id and eth_dev_id re= turns error bypassing the freeing of memory get from strdup() in error case. Thanks, Ganapati > -----Original Message----- > From: Kundapura, Ganapati > Sent: 02 February 2022 20:24 > To: Kundapura, Ganapati ; Weiguo Li > ; Jayatheerthan, Jay > Cc: Naga Harish K, S V ; dev@dpdk.org > Subject: RE: [PATCH v2] eventdev/eth_rx: fix memory leak when token > parsing finished >=20 > Hi Weigo, > Could you please address the below issues also? >=20 > Thanks, > Ganapati > > -----Original Message----- > > From: Kundapura, Ganapati > > Sent: 02 February 2022 13:18 > > To: Weiguo Li ; Jayatheerthan, Jay > > > > Cc: Naga Harish K, S V ; dev@dpdk.org > > Subject: RE: [PATCH v2] eventdev/eth_rx: fix memory leak when token > > parsing finished > > > > Acked-by: Ganapati Kundapura > > > > > -----Original Message----- > > > From: Weiguo Li > > > Sent: 02 February 2022 13:11 > > > To: Jayatheerthan, Jay > > > Cc: Kundapura, Ganapati ; Naga Harish > > > K, S V ; dev@dpdk.org > > > Subject: [PATCH v2] eventdev/eth_rx: fix memory leak when token > > > parsing finished > > > > > > The memory get from strdup should be freed when parameter parsing > > > finished, and also should be freed when error occurs. > > > > > > Fixes: 814d01709328 ("eventdev/eth_rx: support telemetry") > > > Fixes: 9e583185318f ("eventdev/eth_rx: support telemetry") > > > > > > Signed-off-by: Weiguo Li > > > --- > > > v2: > > > * add memory check after strdup > > > --- > > > lib/eventdev/rte_event_eth_rx_adapter.c | 45 ++++++++++++++++++- > --- > > -- > > > - > > > 1 file changed, 33 insertions(+), 12 deletions(-) > > > > > > diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c > > > b/lib/eventdev/rte_event_eth_rx_adapter.c > > > index ae1e260c08..8519c98b19 100644 > > > --- a/lib/eventdev/rte_event_eth_rx_adapter.c > > > +++ b/lib/eventdev/rte_event_eth_rx_adapter.c > > > @@ -3332,26 +3332,31 @@ handle_rxa_get_queue_conf(const char > *cmd > > > __rte_unused, > > > > > > /* Get Rx adapter ID from parameter string */ > > > l_params =3D strdup(params); > > > + if (l_params =3D=3D NULL) > > > + return -ENOMEM; > > > token =3D strtok(l_params, ","); > Validate token here > > > rx_adapter_id =3D strtoul(token, NULL, 10); > > > > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter > > > _id, -EINVAL); > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get device ID from parameter string */ > > > eth_dev_id =3D strtoul(token, NULL, 10); > > > RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); > Use RTE_ETH_VALID_PORTID_OR_ERR_RET to validate eth_dev_id > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get Rx queue ID from parameter string */ > > > rx_queue_id =3D strtoul(token, NULL, 10); > > > if (rx_queue_id >=3D rte_eth_devices[eth_dev_id].data- > > > >nb_rx_queues) { > > > RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", > > rx_queue_id); > > > + free(l_params); > > > return -EINVAL; > > > } > > > > > > @@ -3359,6 +3364,8 @@ handle_rxa_get_queue_conf(const char *cmd > > > __rte_unused, > > > if (token !=3D NULL) > > > RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" > > > " telemetry command, ignoring"); > > > + /* Parsing parameter finished */ > > > + free(l_params); > > > > > > if (rte_event_eth_rx_adapter_queue_conf_get(rx_adapter_id, > > > eth_dev_id, > > > rx_queue_id, > > > &queue_conf)) { > > > @@ -3396,26 +3403,31 @@ handle_rxa_get_queue_stats(const char > *cmd > > > __rte_unused, > > > > > > /* Get Rx adapter ID from parameter string */ > > > l_params =3D strdup(params); > > > + if (l_params =3D=3D NULL) > > > + return -ENOMEM; > > > token =3D strtok(l_params, ","); > Validate token here > > > rx_adapter_id =3D strtoul(token, NULL, 10); > > > > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter > > > _id, -EINVAL); > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get device ID from parameter string */ > > > eth_dev_id =3D strtoul(token, NULL, 10); > > > RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); > Use RTE_ETH_VALID_PORTID_OR_ERR_RET to validate eth_dev_id > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get Rx queue ID from parameter string */ > > > rx_queue_id =3D strtoul(token, NULL, 10); > > > if (rx_queue_id >=3D rte_eth_devices[eth_dev_id].data- > > > >nb_rx_queues) { > > > RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", > > rx_queue_id); > > > + free(l_params); > > > return -EINVAL; > > > } > > > > > > @@ -3423,6 +3435,8 @@ handle_rxa_get_queue_stats(const char *cmd > > > __rte_unused, > > > if (token !=3D NULL) > > > RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" > > > " telemetry command, ignoring"); > > > + /* Parsing parameter finished */ > > > + free(l_params); > > > > > > if (rte_event_eth_rx_adapter_queue_stats_get(rx_adapter_id, > > > eth_dev_id, > > > rx_queue_id, &q_stats)) { > @@ -3458,26 +3472,31 @@ > > > handle_rxa_queue_stats_reset(const char > > *cmd > > > __rte_unused, > > > > > > /* Get Rx adapter ID from parameter string */ > > > l_params =3D strdup(params); > > > + if (l_params =3D=3D NULL) > > > + return -ENOMEM; > > > token =3D strtok(l_params, ","); > Validate token > > > rx_adapter_id =3D strtoul(token, NULL, 10); > > > > > > RTE_EVENT_ETH_RX_ADAPTER_ID_VALID_OR_ERR_RET(rx_adapter > > > _id, -EINVAL); > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get device ID from parameter string */ > > > eth_dev_id =3D strtoul(token, NULL, 10); > > > RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(eth_dev_id, -EINVAL); > Use RTE_ETH_VALID_PORTID_OR_ERR_RET to validate eth_dev_id > > > > > > token =3D strtok(NULL, ","); > > > - if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) > > > + if (token =3D=3D NULL || strlen(token) =3D=3D 0 || !isdigit(*token)= ) { > > > + free(l_params); > > > return -1; > > > - > > > + } > > > /* Get Rx queue ID from parameter string */ > > > rx_queue_id =3D strtoul(token, NULL, 10); > > > if (rx_queue_id >=3D rte_eth_devices[eth_dev_id].data- > > > >nb_rx_queues) { > > > RTE_EDEV_LOG_ERR("Invalid rx queue_id %u", > > rx_queue_id); > > > + free(l_params); > > > return -EINVAL; > > > } > > > > > > @@ -3485,6 +3504,8 @@ handle_rxa_queue_stats_reset(const char > *cmd > > > __rte_unused, > > > if (token !=3D NULL) > > > RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" > > > " telemetry command, ignoring"); > > > + /* Parsing parameter finished */ > > > + free(l_params); > > > > > > if (rte_event_eth_rx_adapter_queue_stats_reset(rx_adapter_id, > > > eth_dev_id, > > > -- > > > 2.25.1