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 D8932A054D for ; Wed, 29 Jun 2022 18:53:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CF2D5427F3; Wed, 29 Jun 2022 18:53:41 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 3F22C40691; Wed, 29 Jun 2022 18:53:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656521619; x=1688057619; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=wY8i/fjuYG0mZRydSGT4qkuPhK2B91y7Wmm5/uoCml8=; b=Nitd6EALqFQOIl30hmhy1w5odQXewqDQY8CwBpsxG7lEWhKM8M8/6lgD FlCOTc7gOrAuRclenV5R/mu45M/qwQVkbdN5X5GDSYMyD5tz0d8HiAzIU 7P8eHRrnJrYAehdt7GtETBC9wRMBsuyvlkBdPLceCS5P8t7FotQhq0xFX z+i3xy8mXULCNbgkJRZkMxxjoOH5EiI5za4rTPb0zL6UOcycgpuCO5dyg mOYtCUyAfYWw9F3P1MKEJj7aTgwdcwh6DK59OpeJkea98td6dBu1sC1/c SFtMx9MIsmQJpN7GbQ+CiwPZf76Fp2zfRlp7MxQd3kw/vEyJQHy2mx6G6 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10393"; a="261883003" X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="261883003" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2022 09:53:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="680584266" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by FMSMGA003.fm.intel.com with ESMTP; 29 Jun 2022 09:53:38 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 29 Jun 2022 09:53:37 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 29 Jun 2022 09:53:37 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 29 Jun 2022 09:53:37 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 29 Jun 2022 09:53:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hS2XYcN7SnmSJqML9qJvT5JVuGrFAyDFvwIDwsp/wzYT6zjj49kwrRnHqi/FdoHmbRytH4lryFaBex70lha9Dfgl3xcqAGNl1xXRDAXOwr4ZJupd4zrXuymHUhCUyyRxqmL9FPe4slVpwu3qxtWaZO3TgjZns3ruM+GJZWRnM6+XwlUMPdgo/cEyaYOeYmgZwqxt2vi6RxntVT/dNp6tRT5gjqjo2VWHt5KYSippOMlsc8AFcNcUMpUsRZzxKH4WYORPQ91cuBeKAIDhfHkzjJ0OaBGmhN5hkG5VI/H9nNdawDI8PJi8uN7KoV8jdxdH3p0e/UwOQRFwGJtFRkFBoA== 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=MZQVLk6AnDQ+ZsTMN8ubhTRJk5yp82ojcQas+yarZGE=; b=GdGuAzptlrlV4wGFSoLMnF8mxySGgbdSHu4e8cALYbxvXpZui6fMupucL51dozOoJHUQ/SCQbJcomUeTxPlh0R+f5P7ogOO6Ac56jPKvETBX4Np8sLUoLmMzbSnQ9hJ8MOSGZecOk95ci0Zm+4WYufmw/uZc+S3FepCrR14isv8eo2wK322UkVDMaQP0F4ih6eeFId6jE6ryWj3UPYs2wQv9/DQsFeRJhM/S9GGkG4uSC0GniIuO79elTA4PO473MOBIdfgffS9rxARyV7wxjIln7Wp/KWbFSIa7h9aTe7DwFQMNzwMbtxhTEW5XJp3U37IQRs90lDkcjgycVsBhmg== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) by SN6PR11MB3456.namprd11.prod.outlook.com (2603:10b6:805:c8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Wed, 29 Jun 2022 16:53:35 +0000 Received: from MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::2890:cc50:6923:e01d]) by MWHPR11MB0062.namprd11.prod.outlook.com ([fe80::2890:cc50:6923:e01d%6]) with mapi id 15.20.5373.018; Wed, 29 Jun 2022 16:53:35 +0000 Message-ID: <46bc5dbf-dfc1-b042-a249-a644af61223f@intel.com> Date: Wed, 29 Jun 2022 22:23:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] app/testpmd: fix memory leak for dscp table Content-Language: en-US To: "Morrissey, Sean" , Jasvinder Singh , CC: , References: <20220628132916.1284235-1-jasvinder.singh@intel.com> From: "Singh, Aman Deep" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: PN2PR01CA0051.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:22::26) To MWHPR11MB0062.namprd11.prod.outlook.com (2603:10b6:301:67::34) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 232e50bd-bee7-44e3-09c1-08da59efe79e X-MS-TrafficTypeDiagnostic: SN6PR11MB3456:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o4+L/EQ9RRnWMIMzhjKwVbJrj4hYfXVcc4XtR9qNomQQPOHAiLTvJ14mWYLgl87OVykGM0E93aL/A0gFMlnnO7SRoEeC5pVmWEOvoVoM5JpIqG5/yKe4O3zuLEvIJnh+41bcSoQUQ62IT6DwKQqG5KJeBM/4U7PdkiC3Vqe/c3pEJwABjanvLSglqzr37lay1gSm+ZUh06GEVXGGR4sICqigEdmlXj5bFzHum/wSfPcfXpnNMK9TBST28V4ECdrCB6gw7dWyd6tyZNo8mgv7+rXzKnGIuoDvc6nurR1evB+hOfB/vfkbR6ZuznZHnY4ZnCCTLo7Xv4OuZD5T3Ak1k4vqRVFQCBFLDfJGTASlev2P4SrLA1qTDTTGUMfUI8TE825DfZ15YFAyM7nRzIp9A5N3dsb23l1H3S6N9BPqWh8fIYKP27IlXUd2yvJJTbTvzZd84H+JWjopOxe1wQ+92wI95xQSzWfh7VwDAiVaanf4/k/PlvKalXjxGZ1ULyRVwYXEsrpinuo8ZaaX4YpMXtdl6JofuvhwLHvB+oqf3s41Ors/hZVRd/9bepjBJNwrx2auldrUfta74AG1cK83/boQKxSegVs6JvUO93e6RdEhVdnE93DV/vW3YSCaEb908bGIY7D4/Fxn0VdtQilZoCnj8g0VqYKvATbU790XhsQDEO0rq1pN2UBvyraRPtYv46p9KS/C7nLNmdxMFv9fZIvFg9UkbuSgLyPnOrbKnILIBGrmzXbpZiJi82qmSqtjOscWlVEPyDPkoOm5Uh9VgnCHYrnTxjY+ygEJcoaJOMInAqN6nG//78f4gaPB3kW8hsrekGQcNyehQ0GLMIDetQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB0062.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(396003)(136003)(366004)(39860400002)(346002)(2616005)(186003)(38100700002)(110136005)(66556008)(4326008)(316002)(66476007)(83380400001)(36756003)(66946007)(450100002)(8676002)(31686004)(41300700001)(6506007)(53546011)(6512007)(5660300002)(31696002)(8936002)(478600001)(6486002)(26005)(82960400001)(2906002)(86362001)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QmoxYWFJNzQ0VVg1Wk1obFYwelh2ako2NmtrdmdPM2tMcUZGZUk4SXByei9a?= =?utf-8?B?MEdVUFgwelQrcFZ1NGNObmUzR0NTS2pCNkxaLzlid1c4Nzlnb0R5K3k4eEV4?= =?utf-8?B?eWZsTi9aYVIwTUlaMFdCYVVNYkRnY1hVNFpST3dZa1RmRE1PM2tHaXlhMlZw?= =?utf-8?B?a2FmTW1nRytjMW82R0ovUTVGdkVOVGtoVlQ4cWRLaktIUCsyUUJoTnBKcDRE?= =?utf-8?B?REIxVEFMMlN2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8?B?WW43ZUVaNG1WQXZubTVBZGtXRjViVDZ0eEtwSk9sYkprRVJSNk1KSk9hd0hB?= =?utf-8?B?QUpyRHd3SmUxS1FUT0hqVDRsVGxQMkRkSDhrNE9KeGNLRlhWcEpseVNHR2xx?= =?utf-8?B?R3c9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 232e50bd-bee7-44e3-09c1-08da59efe79e X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB0062.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jun 2022 16:53:35.3826 (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: 3HOpOvwLgtNJda1RwcfsUHUgfYmcLS0AsTVKgYduHL8WFt8GID+6PsEgEW7A0TZPPtHPoFe9kqB/3U+FirgUA/xITufgg4DGyOXBJF6VTcg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3456 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi Jasvinder, Thanks for the patch. On 6/29/2022 9:07 PM, Morrissey, Sean wrote: > Reviewed-by: Sean Morrissey > > Thanks. > > On 28/06/2022 14:29, Jasvinder Singh wrote: >> This patch fixes memory leak reported by coverity. >> >> Coverity issue: 379220 >> Fixes: 9f5488e326d3 ("app/testpmd: support different input color >> method") >> >> Cc: stable@dpdk.org >> >> Signed-off-by: Jasvinder Singh >> --- >>   app/test-pmd/cmdline_mtr.c | 6 +++++- >>   1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c >> index b92e66cedb..833273da0d 100644 >> --- a/app/test-pmd/cmdline_mtr.c >> +++ b/app/test-pmd/cmdline_mtr.c >> @@ -131,8 +131,10 @@ parse_input_color_table_entries(char *str, enum >> rte_color **dscp_table, >>       /* Allocate memory for vlan table */ >>       vlan = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES * >>           sizeof(enum rte_color)); >> -    if (vlan == NULL) >> +    if (vlan == NULL) { >> +        free(*dscp_table); >>           return -1; >> +    } Did we miss one return at line 129, or is it not required- token = strtok_r(str, PARSE_DELIMITER, &str); if (token == NULL) return 0; >>         i = 0; >>       while (1) { >> @@ -144,6 +146,7 @@ parse_input_color_table_entries(char *str, enum >> rte_color **dscp_table, >>               vlan[i++] = RTE_COLOR_RED; >>           else { >>               free(vlan); >> +            free(*dscp_table); >>               return -1; >>           } >>           if (i == MAX_VLAN_TABLE_ENTRIES) >> @@ -152,6 +155,7 @@ parse_input_color_table_entries(char *str, enum >> rte_color **dscp_table, >>           token = strtok_r(str, PARSE_DELIMITER, &str); >>           if (token == NULL) { >>               free(vlan); >> +            free(*dscp_table); >>               return -1; >>           } >>       }