Skip to content

Commit

Permalink
app/testpmd: verify strdup return
Browse files Browse the repository at this point in the history
[ upstream commit 365cdd7d01f70da2b10671aea05c5aaa036d3771 ]

Add verify strdup return value logic.

Fixes: 52e2e7e ("app/testpmd: add protocol-based buffer split")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ivan Malov <ivan.malov@arknetworks.am>
Acked-by: Huisong Li <lihuisong@huawei.com>
  • Loading branch information
fengchengwen authored and bluca committed Mar 7, 2024
1 parent 3baa529 commit c5b1021
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/test-pmd/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,8 @@ parse_hdrs_list(const char *str, const char *item_name, unsigned int max_items,

nb_item = 0;
char *str2 = strdup(str);
if (str2 == NULL)
return nb_item;
cur = strtok_r(str2, ",", &tmp);
while (cur != NULL) {
parsed_items[nb_item] = get_ptype(cur);
Expand Down

0 comments on commit c5b1021

Please sign in to comment.