DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
To: <dev@dpdk.org>
Cc: <xuemingl@nvidia.com>, David Marchand <david.marchand@redhat.com>,
	"Gaetan Rivet" <grive@u256.net>
Subject: [dpdk-dev] [PATCH v1] test: fix devargs test case memory leak
Date: Sat, 23 Oct 2021 20:17:55 +0800	[thread overview]
Message-ID: <20211023121755.169290-1-xuemingl@nvidia.com> (raw)

In layer argument test function, kvargs are parsed and checked without
free. This patch calls rte_kvargs_free() function to avoid memory leak.

Fixes: a4975cd20dca ("test: add devargs test cases")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 app/test/test_devargs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 19036716bf7..16621285d2d 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -43,8 +43,10 @@ test_args(const char *devargs, const char *layer, const char *args, const int n)
 	if ((int)kvlist->count != n) {
 		printf("rte_devargs_parse(%s) %s_str: %s kv number %u, not %d\n",
 		       devargs, layer, args, kvlist->count, n);
+		rte_kvargs_free(kvlist);
 		return -1;
 	}
+	rte_kvargs_free(kvlist);
 	return 0;
 }
 
-- 
2.33.0


             reply	other threads:[~2021-10-23 12:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-23 12:17 Xueming Li [this message]
2021-10-23 12:40 ` David Marchand
2021-10-25  7:42   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211023121755.169290-1-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=grive@u256.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).