From patchwork Wed May 13 20:56:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavan Nikhilesh Bhagavatula X-Patchwork-Id: 70199 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D62CBA00C3; Wed, 13 May 2020 22:56:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB9301D61D; Wed, 13 May 2020 22:56:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4D2241D605 for ; Wed, 13 May 2020 22:56:10 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04DKu9vY004452 for ; Wed, 13 May 2020 13:56:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=jDyHVFdGy6a+dvqETC0gUHBlBwilUxmOfZhY4ZHlTQM=; b=D7iy5vsHoNCOTo7J332DYAiKLGDyRZkcxReV3cVOZG6O1ZW9cI0djULJdpjCOpXKr7Yw +wr+8WBnkaLtEK7tCIS4sgLplb4NxThrSy8rXjxHc8bffCBU0CrHUrodyg6Wu5Ehg7qk DujXNKOiZrmielNcUaZStJFdnbVvccmmIkA1DYg4VLoBypQWELp4WBIBfVJl/vfe4Iq/ /alDCQ914MLPpp4toBz7OkgA238qyOLaB8FIdVmFPlrxktHnJ8U3RGydRRteRgoxA5Zd kz0pNf2f/7i/IjS1b61sy6yZ9j52DGUlHmCd+3Tn1Smh2jOzeGAp9LzEtxaQjuht1kqB HQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3100xjxqf1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 13 May 2020 13:56:09 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 13 May 2020 13:56:07 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 13 May 2020 13:56:06 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 13 May 2020 13:56:06 -0700 Received: from BG-LT7430.marvell.com (BG-LT7430.marvell.com [10.28.161.240]) by maili.marvell.com (Postfix) with ESMTP id ADA203F7043; Wed, 13 May 2020 13:56:04 -0700 (PDT) From: To: , Kiran Kumar K , "Nithin Dabilpuram" CC: , Pavan Nikhilesh Date: Thu, 14 May 2020 02:26:00 +0530 Message-ID: <20200513205600.6584-1-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-13_09:2020-05-13, 2020-05-13 signatures=0 Subject: [dpdk-dev] [PATCH] test/graph_perf: fix memory leaks 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" From: Pavan Nikhilesh Fix memory leaks reported by coverity. Coverity issue: 358440, 358441, 358446. Fixes: 61d77071ab99 ("test/graph: add performance tests") Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob Acked-by: Jerin Jacob --- app/test/test_graph_perf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test/test_graph_perf.c b/app/test/test_graph_perf.c index 3089fb24c..296d99a9d 100644 --- a/app/test/test_graph_perf.c +++ b/app/test/test_graph_perf.c @@ -76,6 +76,8 @@ test_node_ctx_init(const struct rte_graph *graph, struct rte_node *node) RTE_SET_USED(graph); mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ); + if (mz == NULL) + return -ENOMEM; graph_data = mz->addr; node_data = graph_get_node_data(graph_data, nid); node->ctx[0] = node->nb_edges; @@ -570,6 +572,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks, } graph_data->graph_id = graph_id; + free(node_map); for (i = 0; i < graph_data->nb_nodes; i++) free(node_patterns[i]); free(snk_nodes); @@ -578,6 +581,7 @@ graph_init(const char *gname, uint8_t nb_srcs, uint8_t nb_sinks, return 0; pattern_name_free: + free(node_map); for (i = 0; i < graph_data->nb_nodes; i++) free(node_patterns[i]); snk_free: @@ -677,6 +681,8 @@ measure_perf(void) struct test_graph_perf *graph_data; mz = rte_memzone_lookup(TEST_GRAPH_PERF_MZ); + if (mz == NULL) + return -ENOMEM; graph_data = mz->addr; return measure_perf_get(graph_data->graph_id);