From f3efc26638e207b4e671c24a7d4a46f827a84d5c Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 4 Jan 2022 09:56:29 -0500 Subject: [PATCH] add malloc attribute where appropriate --- include/h_malloc.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/h_malloc.h b/include/h_malloc.h index f04d3cd..50001e5 100644 --- a/include/h_malloc.h +++ b/include/h_malloc.h @@ -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;