add malloc attribute where appropriate

This commit is contained in:
Daniel Micay 2022-01-04 09:56:29 -05:00
parent 78cbb964d4
commit f3efc26638

View File

@ -48,11 +48,10 @@ extern "C" {
#endif
// C standard
__attribute__((alloc_size(1))) void *h_malloc(size_t size);
__attribute__((alloc_size(1, 2))) void *h_calloc(size_t nmemb, size_t size);
__attribute__((malloc)) __attribute__((alloc_size(1))) void *h_malloc(size_t size);
__attribute__((malloc)) __attribute__((alloc_size(1, 2))) void *h_calloc(size_t nmemb, size_t size);
__attribute__((alloc_size(2))) void *h_realloc(void *ptr, size_t size);
__attribute__((alloc_align(1)))
__attribute__((alloc_size(2)))
__attribute__((malloc)) __attribute__((alloc_size(2))) __attribute__((alloc_align(1)))
void *h_aligned_alloc(size_t alignment, size_t size);
void h_free(void *ptr);
@ -78,12 +77,11 @@ int h_malloc_info(int options, FILE *fp);
#endif
// obsolete glibc extensions
__attribute__((alloc_align(1)))
__attribute__((alloc_size(2)))
__attribute__((malloc)) __attribute__((alloc_size(2))) __attribute__((alloc_align(1)))
void *h_memalign(size_t alignment, size_t size);
#ifndef __ANDROID__
void *h_valloc(size_t size);
void *h_pvalloc(size_t size);
__attribute__((malloc)) void *h_valloc(size_t size);
__attribute__((malloc)) void *h_pvalloc(size_t size);
#endif
#ifdef __GLIBC__
void h_cfree(void *ptr) __THROW;