[Bug analyzer/106854] [[gnu::malloc(deallocator)]] for non-pointer functions (e.g., fd)

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 7 12:54:49 GMT 2022


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

--- Comment #7 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Alejandro Colomar from comment #6)
> timerfd_create() might not be important if the timer is not correctly
> deleted.  pthread_mutex_init() is another one that is quite more important,
> as leaking such a thing in a multithreaded program will be a pain to debug
> for sure.  This attribute could help detect that.

FWIW I think we'll eventually want to model the pthreads API (e.g. for checking
of locks; see PR 105897), so pthread_mutex_init seems like a function we'd be
better off special-casing, rather than trying to express all of its semantics
with attributes.


More information about the Gcc-bugs mailing list