Skip to content

Commit

Permalink
test: verify strdup return
Browse files Browse the repository at this point in the history
[ upstream commit 68edcacf428994d3088afb6f5278958cc76665da ]

Add verify strdup return value logic.

Fixes: af75078 ("first public release")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
  • Loading branch information
fengchengwen authored and kevintraynor committed Mar 5, 2024
1 parent 868c62a commit f30f9a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/test/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
return -1;
else if (pid == 0) {
/* make a copy of the arguments to be passed to exec */
for (i = 0; i < numargs; i++)
for (i = 0; i < numargs; i++) {
argv_cpy[i] = strdup(argv[i]);
if (argv_cpy[i] == NULL)
rte_panic("Error dup args\n");
}
argv_cpy[i] = NULL;
num = numargs;

Expand Down

0 comments on commit f30f9a3

Please sign in to comment.