Message ID | 20230608013454.15813-1-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 507fe042181c8e481e4463ab66b3f7af897a5500 |
Delegated to: | David Ahern |
Headers | show |
Series | [iproute2] rt_names: check for malloc() failure | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
Hello: This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <stephen@networkplumber.org>: On Wed, 7 Jun 2023 18:34:54 -0700 you wrote: > Fixes issue reported by Gcc 13 analayzer. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/rt_names.c | 4 ++++ > 1 file changed, 4 insertions(+) Here is the summary with links: - [iproute2] rt_names: check for malloc() failure https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=507fe042181c You are awesome, thank you!
diff --git a/lib/rt_names.c b/lib/rt_names.c index b441e98f8078..68db74e301ff 100644 --- a/lib/rt_names.c +++ b/lib/rt_names.c @@ -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)];
Fixes issue reported by Gcc 13 analayzer. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/rt_names.c | 4 ++++ 1 file changed, 4 insertions(+)