mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 05:55:11 +08:00
ifstat: handle strdup return value
get_nlmsg_extended is missing the check as it's done in get_nlmsg v2: don't set the errno value explicitly Signed-off-by: Denis Kirjanov <dkirjanov@suse.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
4b3b5375a7
commit
b22a3430bd
@ -140,6 +140,10 @@ static int get_nlmsg_extended(struct nlmsghdr *m, void *arg)
|
||||
|
||||
n->ifindex = ifsm->ifindex;
|
||||
n->name = strdup(ll_index_to_name(ifsm->ifindex));
|
||||
if (!n->name) {
|
||||
free(n);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sub_type == NO_SUB_TYPE) {
|
||||
memcpy(&n->val, RTA_DATA(tb[filter_type]), sizeof(n->val));
|
||||
|
Loading…
Reference in New Issue
Block a user