Let's try -fanalyzer.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4431 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-08-25 20:57:55 +00:00
parent dcea08f73b
commit daeb88785d
7 changed files with 48 additions and 41 deletions

View File

@ -207,6 +207,10 @@ tf_mem_allocation_t* tf_mem_summarize_allocations(int* out_count)
return result;
}
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
static void* _tf_alloc(int64_t* total, size_t size)
{
size_t overhead = sizeof(size_t);
@ -302,6 +306,9 @@ static void* _tf_realloc(int64_t* total, void* ptr, size_t size)
return NULL;
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
static void _tf_free(int64_t* total, void* ptr)
{
@ -327,6 +334,10 @@ static void* _tf_uv_realloc(void* ptr, size_t size)
return _tf_realloc(&s_uv_malloc_size, ptr, size);
}
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wanalyzer-malloc-leak"
#endif
static void* _tf_uv_calloc(size_t nmemb, size_t size)
{
size_t total_size = nmemb * size;
@ -361,6 +372,9 @@ static void* _tf_uv_calloc(size_t nmemb, size_t size)
return NULL;
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
static void _tf_uv_free(void* ptr)
{
@ -421,7 +435,10 @@ char* tf_strdup(const char* string)
{
size_t len = strlen(string);
char* buffer = tf_malloc(len + 1);
memcpy(buffer, string, len + 1);
if ( buffer)
{
memcpy(buffer, string, len + 1);
}
return buffer;
}