[core,settings] WINPR_ATTR_MALLOC for alloc_array

This commit is contained in:
akallabeth 2024-11-07 10:55:23 +01:00
parent 3f824daca4
commit 7e7ea3e688
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -399,6 +399,12 @@ static BOOL monitor_has_gaps(const rdpSettings* settings, UINT32 start, UINT32 c
return !hasNeighbor;
}
static void alloc_free(UINT32** ptr)
{
free((void*)ptr);
}
WINPR_ATTR_MALLOC(alloc_free, 1)
static UINT32** alloc_array(size_t count)
{
// NOLINTNEXTLINE(clang-analyzer-unix.MallocSizeof)
@ -500,7 +506,7 @@ static BOOL find_path_exists_with_dijkstra(UINT32** graph, size_t count, UINT32
}
}
}
free((void*)cost);
alloc_free(cost);
free(distance);
free(visited);
free(parent);
@ -529,7 +535,7 @@ static BOOL freerdp_settings_client_monitors_have_gaps(const rdpSettings* settin
rc = !find_path_exists_with_dijkstra(graph, count, 0);
fail:
free((void*)graph);
alloc_free(graph);
return rc;
}