From patchwork Thu May 14 11:24:35 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: 70231 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 C6AB1A034E; Thu, 14 May 2020 13:26:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B5DCD1D8D0; Thu, 14 May 2020 13:26:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 0E26F1BE9E for ; Thu, 14 May 2020 13:26:32 +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 04EBJXF6025747 for ; Thu, 14 May 2020 04:26:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=9fDiDENKcIOYf2AVvGUEJEMxaRFTqS63sM3FHXvZuV8=; b=tQ6OA7EiPWjWrEBtYEyVTx8uQHk7RbwaBqxluCLIvHo+6hpYylhm6fmaGjfPAizuDRDh nMdJum4sgPcPbl4fR2aloCXNvnA9lzBlhwe71UG57rgVY1mqeBfQikTPkfH2+786+hHW zAK+rO1ATmFlXN0k4FxAe8G9CdmuiwUpi22HH1XHz6A2CGiHsLcPB6U0mA6HzBmN2kbs X4DRm6on67tguLKPOt+wRwEGVyQlcBPELEdLpDyD1yiBW7B5Kn/Yxx4nzkxpZSWlP46M qpWhE7G8vurhqo4DVaeEiUKIHnI3bziQwdgPSnWo889IiBChBH9Pttz5A1uP5oKK+U+z Ew== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 3100xaj1bv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 14 May 2020 04:26:32 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 May 2020 04:26:30 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 14 May 2020 04:26:29 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 14 May 2020 04:26:29 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 75CEC3F7041; Thu, 14 May 2020 04:26:28 -0700 (PDT) From: To: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram CC: Date: Thu, 14 May 2020 16:54:35 +0530 Message-ID: <20200514112436.29766-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200514090750.14170-1-kirankumark@marvell.com> References: <20200514090750.14170-1-kirankumark@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-14_02:2020-05-14, 2020-05-14 signatures=0 Subject: [dpdk-dev] [PATCH v3] test/graph: fix coverity issues 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 leak and weak crypto issues reported by coverity. Coverity issue: 358439, 358448, 358451 Fixes: 6b89650418("test/graph: add functional tests") Signed-off-by: Kiran Kumar K Acked-by: Jerin Jacob --- 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; } }