mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 05:55:11 +08:00
rt_names: check for malloc() failure
Fixes issue reported by Gcc 13 analayzer. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
5c4697a405
commit
507fe04218
@ -81,6 +81,10 @@ rtnl_hash_initialize(const char *file, struct rtnl_hash_entry **hash, int size)
|
||||
continue;
|
||||
|
||||
entry = malloc(sizeof(*entry));
|
||||
if (entry == NULL) {
|
||||
fprintf(stderr, "malloc error: for entry\n");
|
||||
break;
|
||||
}
|
||||
entry->id = id;
|
||||
entry->name = strdup(namebuf);
|
||||
entry->next = hash[id & (size - 1)];
|
||||
|
Loading…
Reference in New Issue
Block a user