https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99193
--- Comment #4 from Richard W.M. Jones <rjones at redhat dot com> --- And another: https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/daemon/debug.c#L115 debug.c: In function 'debug_help': debug.c:129:9: error: 'r' should have been deallocated with 'free' but was deallocated with 'realloc' [CWE-762] [-Werror=analyzer-mismatching-deallocation] 129 | p = realloc (r, len + 1); /* +1 for the final NUL */ | ^~~~~~~~~~~~~~~~~~~~ 'debug_help': events 1-4 | | 120 | r = strdup ("Commands supported:"); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) allocated here (expects deallocation with 'free') | 121 | if (!r) { | | ~ | | | | | (2) assuming 'r' is non-NULL | | (3) following 'false' branch (when 'r' is non-NULL)... |...... | 126 | len = strlen (r); | | ~~~ | | | | | (4) ...to here | 'debug_help': events 5-7 | | 127 | for (i = 0; cmds[i].cmd != NULL; ++i) { | | ^ | | | | | (5) following 'true' branch... | 128 | len += strlen (cmds[i].cmd) + 1; /* space + new command */ | | ~~~ | | | | | (6) ...to here | 129 | p = realloc (r, len + 1); /* +1 for the final NUL */ | | ~~~~~~~~~~~~~~~~~~~~ | | | | | (7) deallocated with 'realloc' here; allocation at (1) expects deallocation with 'free' | cc1: all warnings being treated as errors