[PATCH v2 13/16] app/test-dma-perf: verify strdup return value
    Chengwen Feng 
    fengchengwen at huawei.com
       
    Fri Nov 10 11:01:14 CET 2023
    
    
  
Add verify strdup return value logic.
Fixes: 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 app/test-dma-perf/main.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c
index e5bccc27da..339ee25eb5 100644
--- a/app/test-dma-perf/main.c
+++ b/app/test-dma-perf/main.c
@@ -206,6 +206,8 @@ parse_lcore_dma(struct test_configure *test_case, const char *value)
 		return -1;
 
 	input = strndup(value, strlen(value) + 1);
+	if (input == NULL)
+		return -1;
 	addrs = input;
 
 	while (*addrs == '\0')
-- 
2.17.1
    
    
More information about the dev
mailing list