From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0088.outbound.protection.outlook.com [104.47.38.88]) by dpdk.org (Postfix) with ESMTP id 184B01BE56 for ; Thu, 5 Jul 2018 07:46:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wH+srUT5KEUWyOezYLA1sIKdUmEFwP/vd1+zTsQoIX8=; b=XvyW6qoqK3ZssHxtEF3dAVtWdR6W0zDkJ9dmHmVJIeHXgJ2OSaNX3mItPaBWjm7drS4Qui0BKnuH+K+KU7WAX+RNzDgWC1UW5hotEC5Ba5+k5w9V03JS2c70aijIrVWX1a54QSXejwzua2J9yFjhG6vlTt7lLnjCCK6jRbV3F2M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Nithin.Dabilpuram@cavium.com; Received: from hyd1351t110.caveonetworks.com.com (115.113.156.2) by MWHPR07MB3182.namprd07.prod.outlook.com (2603:10b6:300:e1::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Thu, 5 Jul 2018 05:46:19 +0000 From: Nithin Dabilpuram To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, kkanas@caviumnetworks.com, Nithin Dabilpuram Date: Thu, 5 Jul 2018 11:15:46 +0530 Message-Id: <1530769547-8586-1-git-send-email-nithin.dabilpuram@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BMXPR01CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:c::16) To MWHPR07MB3182.namprd07.prod.outlook.com (2603:10b6:300:e1::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97484c03-a1a6-4c13-62d4-08d5e23aa302 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:MWHPR07MB3182; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3182; 3:jRpwmYVf7Mk02Sr8LCgcWSNTgZME8bqpGxThwXO6VYo0tyshnNnuuey1Tf3a7fMdhGpXi8ZuwFHEcQuHcKGCfdVDV2YH8nO2EivAKdvc+EsxnYl/47RbLu8AZK2aFt1jksbZugqZSD7K2HulWrC+rrCLSV5+eFQSdWGvWPLtdc+848qEhVdIxwvywu2D73aKSRpUDnj8ukZZ4Xme8fB9CVq3YErlJjHSquv+45X70TsW+4v3oopYG2KpPzOZrbal; 25:JLKgUmmq490AdEZiH6AXoYoOqyECoIrC00N/7mMQRLClDygAAC74UZDihq2gIwHc55NcxA/BLq8+9pDC85346VpnJs7DRqjJKlihB4plV2Gy9nuxeIwKH3pi0IUEDQPHaN14IitPaS27ZjimMkMtF/mNgh8YTBJtzuuXDIEx5GzCfXNK8nYyEx7IQJiOdSz9vS1fUmn7OyC+bf1CLs49EMSZR7J7Rkyqr9GxKLxdWSi+AbYCsy0LeRuCsUc/2ZJCKi4cwOK/AJMWBVV13CpejU+FTEOIpAt8NPChRBllOn34nyyEtLk7HOyQa3WbvXwnx5jIoREwEx+badpevLpybw==; 31:fDtLW6unNRmRfcY0eXyxMLnAZCBHShkmWjg3xYe+xhlGAE56qCJnQqYc2dGrVKg3N7r4G5ahg72OPbjRpF73uMzRFzmz8aHZzlI/RAneTeqBvfuTTqzt8uxO5sV5V82A9jzCgGKNpHjhtllb4NPVwR6MyK3xXnUB+Czub0IlawtH53jxejR6czwJHXEFNPLIih7N498LM86lvp9JNSGf6Z4P0tACwvmSJhFxjRhJCGk= X-MS-TrafficTypeDiagnostic: MWHPR07MB3182: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3182; 20:8AKJ2+WXF0gDlra5s6mlF6Lzpc0RIVPYV2tdfNinKpUrZYZEshhZC3meOSM9L/3ZmaW8az4J/2FhBNsK89dh+sRYI8oCuXhuAvqJyZgRyeRhGcssSptUEgMNM4xDbRV0c2y79XjjKVsVdYKOpEzKqmm8duycPwhP/nZUEonZDH4VLQQS1vJYGjjky3RSstWV44M2YUJq0SA0PRHpqX+YNabSocaEzal68/lmK9Ys2pJi/YHnwZWxJc9jXgohg3R2LaSrKPa8JRTWCu3CeUw+4XTEAuNuLevPB/yhE0PgcBpAycEHGgulCuxfW1PExweJbhfNCnT1iCeFYUChUjBKGPHuixVZSABP4OpyCVahGHpFo0eYgYtbE3fZXgOi35AGmdOm8Wc/3xvGeBZdr9YcGD8f8xfMNXadzuRqZ1LtdMZ2D0QEQF1KM0waYq5zK4ktUoqEC89+NVD8UFwzlOIu50QRn+1cblUcb7mfxNetnmH2gxvNnJqu5yEdD6vIDDs7Md6wNFL00PIL97iBEzUZXjpbLdgeCbQNxpCIrPOLGw/In4cugHZZ6d4hv7shcxyCfn2ybnnq1PZJ4O5FO7EYZTkxExWeoFrUh+rjIAGVWgs=; 4:qn/IFJTgBIkYdv+qFIuRbN+fbdlWGKM4o2S8/iGR0DBTdV3gzuEj48Kz+aslNeSnrLZZi+WC1dPSKMp33ZviYP3wJtKHStsphDBTQ5ZKuOoIsw//hl+kbfe1TPyjT2vpSVqVGULVGmfv+Wgnb6UscfzAgS4FjHT4ItsAhd5/NDBzNS7igoZbxtN1NgxysN7gBEu+ditSwkU3/Tw0CREVkzoAQn4UAmjXOIIkeYJNskTPzPBGMGd+7ixdlZ5zhpSFjmLv21GBCy4z2nTHRjHe96+MOmnu6jSMdUSHGzWe8asyBEto4hOKzJB7Eu8OQrpz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:MWHPR07MB3182; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3182; X-Forefront-PRVS: 0724FCD4CD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(136003)(376002)(39860400002)(396003)(199004)(189003)(52116002)(8676002)(386003)(110136005)(66066001)(25786009)(47776003)(6506007)(50466002)(2906002)(106356001)(105586002)(44832011)(51416003)(50226002)(6512007)(68736007)(478600001)(48376002)(97736004)(72206003)(81166006)(16586007)(316002)(81156014)(6486002)(4326008)(4720700003)(2616005)(6666003)(42882007)(305945005)(956004)(8936002)(55236004)(107886003)(7736002)(476003)(486006)(3846002)(53936002)(5660300001)(16526019)(186003)(6116002)(26005)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3182; H:hyd1351t110.caveonetworks.com.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3182; 23:oOcrWwcEcPPP65JkjEaBjHTcPbKg0lfSr0ERL8bkD?= =?us-ascii?Q?w2Jj7gj6sFaPuSE2BgMsa1OrfbGLjFRk4QhwrbViOuI3NVuKAwhAYGeBuspt?= =?us-ascii?Q?l+mExEL6DH2QaH7sTvRqhd9SyR+aWLemk8IiTgSPG0zDdV3Y3lKa1H8SqakN?= =?us-ascii?Q?2ORoZVCWhJGxnmxi7hjbrnBm4t25B6PqEO36mUNhv8r7NdPEuqKywIP9ijsQ?= =?us-ascii?Q?o5C0yVpHi1tIqxMtWSvm6A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C02cxwDsIx9jlmk2uRGwBzyWZdQGUUFsbJMCF8oujCRVB6PwpH4gWHlbH0FFIwYy2msyaToYvEwxjvY+4AgPfZ3lmPhmmKoSs2i/iKXsvTW6iHwjjbOX9b1jhVnV3pzNMEtigspsX5quS2pOPW1WJRINRg=; 24:9bMmBd+puOLTeyjwj5X1DHjK4cUXXSsMNyMTLMNgF4haac5gqcc4kmbpdnyhZaXHX3EwCldO0KZVz1AiZG2v0z8goGDiMr1DS2HsFst+P7g= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3182; 7:/biosDPpbeVw5CLUbNzcu1FU9XYTNokFFk7QgRtVmoC6DxRgzsspKrZSZV25vQgFG2ArWdN8kB5i8hAHLu9M0b+NQ+hpaglizfQF9AhSxjIKsmzmavDOxR9aCNIW0m5PsYZ1/NO3OOlIGGWwpDecA38VPpzyUFhGo6RJ9XRwNpag//b/Atg5a1Q5IJCrFoSCmaNbGVwrxa73yFhnbe/PuSbfJT1I4Iid+JwxMkNAy7ym3n0J1yJQA2x+H/DWxdqP X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2018 05:46:19.4189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97484c03-a1a6-4c13-62d4-08d5e23aa302 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3182 Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix buffer leak in tm cmdline 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, 05 Jul 2018 05:46:24 -0000 Free the buffer allocated for shared_shaper_id array in case of configuration without shared shapers. Signed-off-by: Nithin Dabilpuram Acked-by: Jasvinder Singh --- v2 changes: - Modify subject to use proper keyword for test-pmd - Change author email address app/test-pmd/cmdline_tm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index c904e44..7c1601f 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -1599,10 +1599,12 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result, np.shaper_profile_id = res->shaper_profile_id; np.n_shared_shapers = n_shared_shapers; - if (np.n_shared_shapers) + if (np.n_shared_shapers) { np.shared_shaper_id = &shared_shaper_id[0]; - else - np.shared_shaper_id = NULL; + } else { + free(shared_shaper_id); + shared_shaper_id = NULL; + } np.nonleaf.n_sp_priorities = res->n_sp_priorities; np.stats_mask = res->stats_mask; @@ -1758,10 +1760,12 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result, np.n_shared_shapers = n_shared_shapers; - if (np.n_shared_shapers) + if (np.n_shared_shapers) { np.shared_shaper_id = &shared_shaper_id[0]; - else - np.shared_shaper_id = NULL; + } else { + free(shared_shaper_id); + shared_shaper_id = NULL; + } np.leaf.cman = res->cman_mode; np.leaf.wred.wred_profile_id = res->wred_profile_id; -- 1.8.3.1