[dpdk-dev] [PATCH 2/2] test/malloc: add bad parameter tests for realloc

Anatoly Burakov anatoly.burakov at intel.com
Wed Apr 1 15:11:01 CEST 2020


Realloc did not have bad parameter autotest. Add them.

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
 app/test/test_malloc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index 3a45a00406..788595ead7 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -826,6 +826,11 @@ test_malloc_bad_params(void)
 	if (bad_ptr != NULL)
 		goto err_return;
 
+	/* rte_realloc expected to return null with inappropriate size */
+	bad_ptr = rte_realloc(NULL, size, align);
+	if (bad_ptr != NULL)
+		goto err_return;
+
 	/* rte_malloc expected to return null with inappropriate alignment */
 	align = 17;
 	size = 1024;
@@ -834,6 +839,11 @@ test_malloc_bad_params(void)
 	if (bad_ptr != NULL)
 		goto err_return;
 
+	/* rte_realloc expected to return null with inappropriate alignment */
+	bad_ptr = rte_realloc(NULL, size, align);
+	if (bad_ptr != NULL)
+		goto err_return;
+
 	return 0;
 
 err_return:
-- 
2.17.1


More information about the dev mailing list