[Bug analyzer/99193] Bogus "should have been deallocated with 'free' but was deallocated with 'realloc' [CWE-762] [-Werror=analyzer-mismatching-deallocation]"

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 25 14:27:15 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99193

--- Comment #11 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
BTW, looking at the 
  #pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
at
https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/df/main.c#L317
I'm guessing that this was due to PR analyzer/99196, due to the:

    name = strdup (drvs->uri.orig_uri);
    if (name == NULL)
      error (EXIT_FAILURE, errno, "strdup");
    p = strrchr (name, '/');

where the analyzer didn't "know" that the error call would terminate the
program; so hopefully this is also fixed now.


More information about the Gcc-bugs mailing list