From patchwork Thu May 14 08:56:57 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: 70219 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 9BF4AA00C3; Thu, 14 May 2020 10:57:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B0101D6D2; Thu, 14 May 2020 10:57:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id E0A5D1D690 for ; Thu, 14 May 2020 10:57:31 +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 04E8uAZv004939 for ; Thu, 14 May 2020 01:57:31 -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=ZJmu50efcxcJ8gmMyQCemFYTbbh8JXDv7F2Xqr6D9X8=; b=bI7GwgJ9VHZJ1j6dFcO6f/GQ0VX+ihiXHi7d2GeSh9c6lfi2xO/OFG+hcjjVOBt1qIeZ XLUEBnpTXYk+0v+vPFfKaopiDiIY7ZzRBY3KramX156v7+RUEjHuCuh46Q+ieIwsLHtI DhqDCelPz9elbKI8jq5thAshXkIapp83VTOr+FXNxQvIPZOF0fxX/A2dbPfqccvQh24W Xh/StDsz+DiJWbCvfVK30MdOn3N21tnYULYlXsx93wVqzddECLMYCOXw/CmbD0cPhTLg iebc3slZVWoTgO5GeOwKo9wkylyccOvQLuflSLBBumLGMpX2EiKr2uWrQM9NtY5fgYkv ZA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3100xk1gv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 May 2020 01:57:31 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 May 2020 01:57:28 -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; Thu, 14 May 2020 01:57:28 -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; Thu, 14 May 2020 01:57:28 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id E183B3F703F; Thu, 14 May 2020 01:57:26 -0700 (PDT) From: To: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram CC: Date: Thu, 14 May 2020 14:26:57 +0530 Message-ID: <20200514085658.12287-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-14_01:2020-05-13, 2020-05-14 signatures=0 Subject: [dpdk-dev] [PATCH v2] 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. Coverity issue: 358439, 358451, 358448. Fixes: 6b89650418("test/graph: add functional tests") Signed-off-by: Kiran Kumar K --- V2 changes: * Added Coverity issue and Fixes info. app/test/test_graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.17.1 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; } }