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 92F6341E65; Fri, 10 Mar 2023 14:20:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4133140A81; Fri, 10 Mar 2023 14:20:27 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id A5AA240685; Fri, 10 Mar 2023 14:20:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678454426; x=1709990426; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=SxAlV7LD5Z/gWKLUKKT9drfj3AgQCVEencHYstFNEpU=; b=T8VIbIdvCZy40dhF23hjAirt1p64FSfQk5XB2TZy3SGtWQwYulk4OfCv hLGxYMDil4FOMwmkDAeA6ovnHmNe88A3y4mWsOCg69xe0ECrfpLPzjEwu wK7kvzN21dRsZElnUT+eCzNZyeqF/zedtHVTU1zjnW6gIsXRif2M+cjk6 HGoMGysdiaV7pkWFdpjJVrMs4mOiJ3q4F2htceIouOWyOJM3WlVV9pm8Z CfPh+QkkhekzNcPv2h+QR94oaEOepn+b/kY+SUqVH75QuW7FXfs4ZgmWi 3MVCW0ljSZBVXvQAn9QzB0D4N0qXqqQC1gWTddjgqBTPySBpubOMPKf0v g==; X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="401584443" X-IronPort-AV: E=Sophos;i="5.98,249,1673942400"; d="scan'208";a="401584443" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2023 05:20:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="801577128" X-IronPort-AV: E=Sophos;i="5.98,249,1673942400"; d="scan'208";a="801577128" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by orsmga004.jf.intel.com with ESMTP; 10 Mar 2023 05:20:19 -0800 From: Ciara Power To: dev@dpdk.org Cc: kai.ji@intel.com, Ciara Power , stable@dpdk.org Subject: [PATCH] app/crypto-perf: fix test file memory leak Date: Fri, 10 Mar 2023 13:20:17 +0000 Message-Id: <20230310132017.6900-1-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org A memory leak was detected using the AddressSanitizer tool, when running the crypto-perf application with a test vector file. The strdup function used returns a pointer to a null-terminated byte string, which must be freed after use. This patch frees the pointer in an error case, and also after a successful run. Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Cc: stable@dpdk.org Signed-off-by: Ciara Power --- app/test-crypto-perf/cperf_options_parsing.c | 1 + app/test-crypto-perf/cperf_test_vector_parsing.c | 1 + 2 files changed, 2 insertions(+) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 8c9f632590..26136a52ae 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -519,6 +519,7 @@ parse_test_file(struct cperf_options *opts, if (access(opts->test_file, F_OK) != -1) return 0; RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n"); + free(opts->test_file); return -1; } diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c index 98e46c3381..737d61d4af 100644 --- a/app/test-crypto-perf/cperf_test_vector_parsing.c +++ b/app/test-crypto-perf/cperf_test_vector_parsing.c @@ -30,6 +30,7 @@ free_test_vector(struct cperf_test_vector *vector, struct cperf_options *opts) rte_free(vector->cipher_key.data); rte_free(vector->auth_key.data); rte_free(vector->ciphertext.data); + free(opts->test_file); } rte_free(vector); -- 2.25.1