[Bug analyzer/103032] false positive diagnostic from -fanalyzer about double-free
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 16 23:23:36 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103032
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I haven't yet reproduced the precise symptoms you reported, but FWIW I'm seeing
this in got_gsd, which looks like a true warning for this code:
| 1903 | psects[psectid] = strdup(name);
| | ~~~~~~~~~~~~
| | |
| | (43) this call could return
NULL
| 1904 | trim(psects[psectid++]);
| | ~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (44) calling ‘trim’ from ‘got_gsd’
|
+--> ‘trim’: events 45-46
|
| 1800 | void trim(
| | ^~~~
| | |
| | (45) entry to ‘trim’
|......
| 1805 | for (cp = buf + strlen(buf); cp > buf; cp--)
| | ~~~~~~~~~~~
| | |
| | (46) argument 1 (‘buf’) from
(43) could be NULL where non-null expected
|
../../src/gcc/testsuite/gcc.dg/analyzer/pr103032.c:1173:8: note: argument 1 of
‘strlen’ must be non-null
1173 | size_t strlen(const char *);
| ^~~~~~
More information about the Gcc-bugs
mailing list