diff mbox series

[v1] test: fix devargs test case memory leak

Message ID 20211023121755.169290-1-xuemingl@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers show
Series [v1] test: fix devargs test case memory leak | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/checkpatch success coding style OK

Commit Message

Xueming(Steven) Li Oct. 23, 2021, 12:17 p.m. UTC
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(+)

Comments

David Marchand Oct. 23, 2021, 12:40 p.m. UTC | #1
On Sat, Oct 23, 2021 at 2:18 PM Xueming Li <xuemingl@nvidia.com> wrote:
>
> In layer argument test function, kvargs are parsed and checked without
> free. This patch calls rte_kvargs_free() function to avoid memory leak.
>

Coverity issue: 373631
> Fixes: a4975cd20dca ("test: add devargs test cases")
>
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
David Marchand Oct. 25, 2021, 7:42 a.m. UTC | #2
On Sat, Oct 23, 2021 at 2:40 PM David Marchand
<david.marchand@redhat.com> wrote:
> On Sat, Oct 23, 2021 at 2:18 PM Xueming Li <xuemingl@nvidia.com> wrote:
> >
> > In layer argument test function, kvargs are parsed and checked without
> > free. This patch calls rte_kvargs_free() function to avoid memory leak.
> >
>
> Coverity issue: 373631
> > Fixes: a4975cd20dca ("test: add devargs test cases")
> >
> > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
diff mbox series

Patch

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;
 }