[gcc] fix missing malloc warning macros

* Add missing WINPR_ATTR_MALLOC
* Add missing WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
This commit is contained in:
Armin Novak 2024-04-17 09:20:29 +02:00 committed by akallabeth
parent fdc253e909
commit 28e9094f08
12 changed files with 42 additions and 1 deletions

View File

@ -1169,7 +1169,10 @@ CLEAR_CONTEXT* clear_context_new(BOOL Compressor)
return clear;
error_nsc:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
clear_context_free(clear);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -735,7 +735,10 @@ BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(BOOL Compressor)
return interleaved;
fail:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
bitmap_interleaved_context_free(interleaved);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -363,7 +363,10 @@ NSC_CONTEXT* nsc_context_new(void)
NSC_INIT_SIMD(context);
return context;
error:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
nsc_context_free(context);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -1747,7 +1747,10 @@ BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 max
if (!freerdp_bitmap_planar_context_reset(context, maxWidth, maxHeight))
{
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
freerdp_bitmap_planar_context_free(context);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -2631,7 +2631,10 @@ PROGRESSIVE_CONTEXT* progressive_context_new_ex(BOOL Compressor, UINT32 Threadin
}
return progressive;
fail:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
progressive_context_free(progressive);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -342,7 +342,10 @@ RFX_CONTEXT* rfx_context_new_ex(BOOL encoder, UINT32 ThreadingFlags)
context->expectedDataBlockType = WBT_FRAME_BEGIN;
return context;
fail:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
rfx_context_free(context);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -251,7 +251,10 @@ YUV_CONTEXT* yuv_context_new(BOOL encoder, UINT32 ThreadingFlags)
return ret;
error_threadpool:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
yuv_context_free(ret);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -2171,7 +2171,9 @@ static BOOL update_read_ellipse_cb_order(const char* orderName, wStream* s,
return TRUE;
return FALSE;
}
/* Secondary Drawing Orders */
WINPR_ATTR_MALLOC(free_cache_bitmap_order, 2)
static CACHE_BITMAP_ORDER* update_read_cache_bitmap_order(rdpUpdate* update, wStream* s,
BOOL compressed, UINT16 flags)
{
@ -2290,6 +2292,7 @@ BOOL update_write_cache_bitmap_order(wStream* s, const CACHE_BITMAP_ORDER* cache
return TRUE;
}
WINPR_ATTR_MALLOC(free_cache_bitmap_v2_order, 2)
static CACHE_BITMAP_V2_ORDER* update_read_cache_bitmap_v2_order(rdpUpdate* update, wStream* s,
BOOL compressed, UINT16 flags)
{
@ -2466,6 +2469,8 @@ BOOL update_write_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache
cache_bitmap_v2->compressed = compressed;
return TRUE;
}
WINPR_ATTR_MALLOC(free_cache_bitmap_v3_order, 2)
static CACHE_BITMAP_V3_ORDER* update_read_cache_bitmap_v3_order(rdpUpdate* update, wStream* s,
UINT16 flags)
{
@ -2571,6 +2576,8 @@ BOOL update_write_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache
Stream_Write(s, bitmapData->data, bitmapData->length);
return TRUE;
}
WINPR_ATTR_MALLOC(free_cache_color_table_order, 2)
static CACHE_COLOR_TABLE_ORDER* update_read_cache_color_table_order(rdpUpdate* update, wStream* s,
UINT16 flags)
{

View File

@ -1343,7 +1343,10 @@ HANDLE CommCreateFileA(LPCSTR lpDeviceName, DWORD dwDesiredAccess, DWORD dwShare
return (HANDLE)pComm;
error_handle:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
CloseHandle(pComm);
WINPR_PRAGMA_DIAG_POP
return INVALID_HANDLE_VALUE;
}

View File

@ -925,7 +925,10 @@ static WIN32_FILE_SEARCH* file_search_new(const char* name, size_t namelen, cons
return pFileSearch;
fail:
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
FindClose(pFileSearch);
WINPR_PRAGMA_DIAG_POP
return NULL;
}

View File

@ -98,6 +98,7 @@ static BOOL find_first_file_success(const char* FilePath)
}
rc = TRUE;
fail:
if (hFind != INVALID_HANDLE_VALUE)
FindClose(hFind);
return rc;
}

View File

@ -124,7 +124,13 @@ static BOOL TestStream_Static(void)
if (v != 2)
return FALSE;
// Intentional warning as the stream is not allocated.
// Still, Stream_Free should not release such memory, therefore this statement
// is required to test that.
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
Stream_Free(s, TRUE);
WINPR_PRAGMA_DIAG_POP
return TRUE;
}