[v2,12/16] app/test-crypto-perf: verify strdup return value
Checks
Commit Message
Add verify strdup return value logic.
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/test-crypto-perf/cperf_options_parsing.c | 4 ++++
1 file changed, 4 insertions(+)
@@ -516,6 +516,10 @@ parse_test_file(struct cperf_options *opts,
const char *arg)
{
opts->test_file = strdup(arg);
+ if (opts->test_file == NULL) {
+ RTE_LOG(ERR, USER1, "Dup vector file failed!\n");
+ return -1;
+ }
if (access(opts->test_file, F_OK) != -1)
return 0;
RTE_LOG(ERR, USER1, "Test vector file doesn't exist\n");