[Bug c/85055] warn on accessing free memory
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 7 01:40:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85055
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dmalcolm at gcc dot gnu.org
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
My analyser reports on this:
pr85055.c: In function ‘f’:
pr85055.c:6:13: warning: use after ‘free’ of ‘foo’ [CWE-416]
[-Wanalyzer-use-after-free]
6 | return foo[0];
| ~~~^~~
‘f’: events 1-2
|
| 5 | free(foo);
| | ^~~~~~~~~
| | |
| | (1) freed here
| 6 | return foo[0];
| | ~~~~~~
| | |
| | (2) use after ‘free’ of ‘foo’; freed at (1)
|
More information about the Gcc-bugs
mailing list