From patchwork Fri May 15 07:28:24 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: 70304 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 2F7B5A00C3; Fri, 15 May 2020 09:29:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 942151DA55; Fri, 15 May 2020 09:29:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id BF7C91DA0B for ; Fri, 15 May 2020 09:29:01 +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 04F7Plw7007250 for ; Fri, 15 May 2020 00:29:00 -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=I/u0dg6c9zBRe8y71me+j2jgOzI8U6FMxnaE/cSXb64=; b=O//hsDkbtxFCb6cQSqF7SiK+wk0asQcFnJZQve1a3yPar3Fn5GLSteAUyb0WssbMy3us V4USHswRqndgHD5XM5hQg7pq94K+WIW1wDxb5XJ89ndfsek4KehTU3CrxLXYoRSjUXnx /oF4iGGJgWMb0HTIzxiZAVRJqV2sWpBOWTyrKI2rSZ9Rx1h0Lq3AqeA/beczmAsdUCKC F8x8hSTg67bclnEDEdZag/NxJdntktB3xz2F1FUbRrIqm+IZJ2HVfzcH7kQdb9KLPego T9xKf9IS35FsW8e2HcA3Py5NQBDUA0NyW3BUjb8URUoiKAKkKmbCuHIMgq4oQbe5cMl2 sQ== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 3100xapsyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 15 May 2020 00:29:00 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 15 May 2020 00:28:59 -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; Fri, 15 May 2020 00:28:59 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id EB2443F703F; Fri, 15 May 2020 00:28:57 -0700 (PDT) From: To: Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram CC: Date: Fri, 15 May 2020 12:58:24 +0530 Message-ID: <20200515072824.23044-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200514112436.29766-1-kirankumark@marvell.com> References: <20200514112436.29766-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-15_02:2020-05-14, 2020-05-15 signatures=0 Subject: [dpdk-dev] [PATCH v4] 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 --- V4 Changes: * Added space before bracket in Fixes. 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; } }