https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117809
Bug ID: 117809 Summary: feature request: attribute malloc but for non-function-return-value return values Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: felix-gcc at fefe dot de Target Milestone: --- I love attribute malloc! I would like to annotate all my functions with it where applicable! But you can only do it for functions that return the malloced memory as return value from the function. What about this type of function: errno_t my_malloc(void** ptr, size_t len); I'd love to add something like this: __attribute__((malloc2(1,my_free,2))) errno_t my_malloc(void** ptr, size_t len); Here is a more real-world example, from the GNUNET interface to jansson (json lib): struct GNUNET_JSON_Specification GNUNET_JSON_spec_json (const char *name, json_t **jsonp); I'd like to be able to annotate the second argument.