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

            Bug ID: 111025
           Summary: attribute((malloc)) and posix_memalign() (and other
                    functions that return newly allocated object address
                    into an output parameter)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yann at droneaud dot fr
  Target Milestone: ---

Functions such as posix_memalign() don't return the pointer to the newly
allocated memory as their return value, thus attribute((malloc)) cannot be used
with them.

It would be useful to have some form of attribute((malloc)) that could apply to
function such as posix_memalign().

This new attribute((malloc)) form could also be used on asprintf() for example.

With support for the attribute((malloc))'s deallocator specification, it could
improve warnings at compile time and prevents developer mistake.

Reply via email to