From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 646F3425E4 for ; Wed, 20 Sep 2023 09:09:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CC88406B8; Wed, 20 Sep 2023 09:09:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 54DAF4028C; Wed, 20 Sep 2023 09:09:49 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38K63B38002916; Wed, 20 Sep 2023 00:09:48 -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=pfpt0220; bh=QVbY3UgNbYtsc8dJv8Rn43H/MDwaggE2Bwm+v49bqh8=; b=c99jMzOgHbPxOvngEKcl+lXT0U2/p3IRJgWqHpFBzzVkKhEp2IGup3Z6g4LHtRTPbu3W JAR/aha9GusqDzFWn46BKB3Y5rLzBd16vJzzhXQnhnt1xqGc1wTUrZrhCyGf2gJTWaUK XGl7nLMmXKAJBKvcpwF2GDiQIqXtW55z/ofR5t67D+Iq8RZiZGScO+UEx4BwtUOfo11/ tH1O9/+bHhJeoe723tcMbLki2odzEhBUGQffQ00GryACMfRZqFTCH6VyqhZ3Na7HB43+ 129ElYOLIu7a4X4TLsdFrgKXnKJozzCWsUqqWMDzvCzet7xz4VHheTDsk7yL22U6qfYS MA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3t7u4d87v6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 20 Sep 2023 00:09:48 -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.48; Wed, 20 Sep 2023 00:09:43 -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.48 via Frontend Transport; Wed, 20 Sep 2023 00:09:43 -0700 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id E2CBA5B6926; Wed, 20 Sep 2023 00:09:43 -0700 (PDT) From: Srikanth Yalavarthi To: Srikanth Yalavarthi CC: , , , , Subject: [PATCH v1 1/1] app/mldev: fix file and buffer handling Date: Wed, 20 Sep 2023 00:09:41 -0700 Message-ID: <20230920070941.8626-1-syalavarthi@marvell.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: ZNo8y6VGISzaqA6EvgyR-YgAvtXxEGMe X-Proofpoint-GUID: ZNo8y6VGISzaqA6EvgyR-YgAvtXxEGMe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-20_02,2023-09-19_01,2023-05-22_02 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Addressed issues reported by klocwork static analysis tool. Fixes: fccf444cfe05 ("app/mldev: add function for file read") Cc: stable@dpdk.org Signed-off-by: Srikanth Yalavarthi --- app/test-mldev/test_common.c | 1 + app/test-mldev/test_inference_common.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/test-mldev/test_common.c b/app/test-mldev/test_common.c index 357a85a312..90e591f205 100644 --- a/app/test-mldev/test_common.c +++ b/app/test-mldev/test_common.c @@ -34,6 +34,7 @@ ml_read_file(char *file, size_t *size, char **buffer) if (fstat(fd, &file_stat) != 0) { ml_err("fstat failed for file: %s\n", file); + close(fd); return -errno; } diff --git a/app/test-mldev/test_inference_common.c b/app/test-mldev/test_inference_common.c index 418bf38be4..05b221401b 100644 --- a/app/test-mldev/test_inference_common.c +++ b/app/test-mldev/test_inference_common.c @@ -653,6 +653,7 @@ ml_inference_iomem_setup(struct ml_test *test, struct ml_options *opt, uint16_t ml_err("Invalid input file, size = %zu (expected size = %" PRIu64 ")\n", fsize, t->model[fid].inp_dsize); ret = -EINVAL; + free(buffer); goto error; } @@ -670,6 +671,7 @@ ml_inference_iomem_setup(struct ml_test *test, struct ml_options *opt, uint16_t ml_err("Invalid reference file, size = %zu (expected size = %" PRIu64 ")\n", fsize, t->model[fid].out_dsize); ret = -EINVAL; + free(buffer); goto error; } } @@ -703,8 +705,6 @@ ml_inference_iomem_setup(struct ml_test *test, struct ml_options *opt, uint16_t t->model[fid].io_pool = NULL; } - free(buffer); - return ret; } -- 2.41.0