[Bug c++/53215] Warn if orphaned memory is created by ignoring return value of new

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 10 03:48:00 GMT 2019


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

--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> 
> We could probably teach the compiler to warn about unused results of
> anything with attribute__((malloc))

That would probably be a good thing to do anyways, given that the GNU Coding
Standards say to always check the result of malloc: 

https://www.gnu.org/prep/standards/html_node/Semantics.html#Semantics


More information about the Gcc-bugs mailing list