Add verify strdup return value logic.

Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
Cc: sta...@dpdk.org

Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
---
 app/pdump/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 7a1c7bdf60..a9205e130b 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -171,6 +171,9 @@ parse_device_id(const char *key __rte_unused, const char 
*value,
        struct pdump_tuples *pt = extra_args;
 
        pt->device_id = strdup(value);
+       if (pt->device_id == NULL)
+               return -1;
+
        pt->dump_by_type = DEVICE_ID;
 
        return 0;
-- 
2.17.1

Reply via email to