Skip to contentSkip to conversation

test: fix devargs test case memory leak

PATCH Applied Xueming Li 2 participants 3 messages Oct 23, 2021 – Oct 25, 2021

lore
Share & tools
lore

Xueming Li

author
#0 lore raw

PATCH 1/1 test: fix devargs test case memory leak

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")
---
 app/test/test_devargs.c | 2 ++
 1 file changed, 2 insertions(+)
app/test/test_devargs.c +2 -0
index 19036716bf7..16621285d2d 100644
@@ -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;
 }
 
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Xueming Li

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

Quoted 3 lines
Fixes a4975cd20dca ("test: add devargs test cases")
Signature · 1 line
David Marchand
#2 lore raw
Quoted 11 lines · David Marchand
Quoted 4 lines · Xueming Li

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

Quoted 3 lines
Fixes a4975cd20dca ("test: add devargs test cases")

Applied, thanks.

Signature · 1 line
David Marchand