From patchwork Thu May 14 03:31:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiran Kumar Kokkilagadda X-Patchwork-Id: 70202 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 E9B64A00C3; Thu, 14 May 2020 05:32:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 128391D575; Thu, 14 May 2020 05:32:20 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 0D4FF1D525 for ; Thu, 14 May 2020 05:32:18 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04E3Tm3A020304 for ; Wed, 13 May 2020 20:32:18 -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-type; s=pfpt0818; bh=eFYgVmXho3zbS3GhK9EhfmE7p1ruhnS2cW2shyStEYE=; b=xTe7NfSlFXFGJ/SnPV0RKDpBcBngOFU6tTOrDHteloPHcp2NLg0TF2l899bD21N4r5JX Nb8bqGPtr8stsfSGkMVtGL6uSagQO8xy7RR3oDQQUK8yUBpPy4et+DElv4ofmpzOvh3i SubuR6D4ZpTDqXKeMC7NXRtc0oiuKuBrvS6ljDexCMBlVWsXdQIVkbyZ7NVuUPZMH5cF J119Ex+gAvPgmyFPta1XDFdG56ebcEMj1IsECEL6vEEqXkgQLkWmqmlbf5sTAYVVGgbH gAFJKMqUpA+HMIMtz/ZdHEzwkOj7YNnM3HtDgeQ1NObnln3x+yvkZu0oLmGCh/S21IrK Rg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3100xagacg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 13 May 2020 20:32:17 -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 20:32:16 -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 20:32:16 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 262463F704C; Wed, 13 May 2020 20:32:14 -0700 (PDT) From: To: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram CC: Date: Thu, 14 May 2020 09:01:40 +0530 Message-ID: <20200514033140.11340-1-kirankumark@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: fix memory leak 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: Kiran Kumar K Fix memory leaks reported by coverity. Signed-off-by: Kiran Kumar K --- app/test/test_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index cf6df0744..ed69eda99 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "test.h" @@ -145,7 +146,7 @@ uint16_t test_node_worker_source(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { - uint32_t obj_node0 = rand() % 100, obj_node1; + uint32_t obj_node0 = rte_rand() % 100, obj_node1; test_main_t *tm = &test_main; struct rte_mbuf *data; void **next_stream; @@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, test_main_t *tm = &test_main; if (*(uint32_t *)node->ctx == test_node0.id) { - uint32_t obj_node0 = rand() % 100, obj_node1; + uint32_t obj_node0 = rte_rand() % 100, obj_node1; struct rte_mbuf *data; uint8_t second_pass = 0; uint32_t count = 0; @@ -496,6 +497,7 @@ test_lookup_functions(void) printf("Test number of edges for node = %s failed Expected = %d, got %d\n", tm->test_node[i].node.name, tm->test_node[i].node.nb_edges, count); + free(next_edges); return -1; } @@ -505,6 +507,7 @@ test_lookup_functions(void) printf("Edge name miss match, expected = %s got = %s\n", tm->test_node[i].node.next_nodes[j], next_edges[j]); + free(next_edges); return -1; } }