mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-08 09:18:29 +00:00
GCC 12 correctly reports a potential use-after-free condition in the
xrealloc helper. Fix the warning by avoiding an implicit "free(ptr)"
when size == 0:
In file included from help.c:12:
In function 'xrealloc',
inlined from 'add_cmdname' at help.c:24:2: subcmd-util.h:56:23: error: pointer may be used after 'realloc' [-Werror=use-after-free]
56 | ret = realloc(ptr, size);
| ^~~~~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
52 | void *ret = realloc(ptr, size);
| ^~~~~~~~~~~~~~~~~~
subcmd-util.h:58:31: error: pointer may be used after 'realloc' [-Werror=use-after-free]
58 | ret = realloc(ptr, 1);
| ^~~~~~~~~~~~~~~
subcmd-util.h:52:21: note: call to 'realloc' here
52 | void *ret = realloc(ptr, size);
| ^~~~~~~~~~~~~~~~~~
Fixes:
|
||
|---|---|---|
| .. | ||
| Build | ||
| exec-cmd.c | ||
| exec-cmd.h | ||
| help.c | ||
| help.h | ||
| Makefile | ||
| pager.c | ||
| pager.h | ||
| parse-options.c | ||
| parse-options.h | ||
| run-command.c | ||
| run-command.h | ||
| sigchain.c | ||
| sigchain.h | ||
| subcmd-config.c | ||
| subcmd-config.h | ||
| subcmd-util.h | ||