mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-18 14:48:53 +02:00
tests: Avoid calling malloc(0) in gvariant tests
Its behaviour is implementation-defined according to POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html), and we’d quite like it to consistently return `NULL` for a zero-size allocation. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -1352,7 +1352,7 @@ align_malloc (gsize size)
|
|||||||
* have malloc() that returns non-8-aligned. if so, we need to try
|
* have malloc() that returns non-8-aligned. if so, we need to try
|
||||||
* harder here.
|
* harder here.
|
||||||
*/
|
*/
|
||||||
mem = malloc (size);
|
mem = (size > 0) ? malloc (size) : NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
|
Reference in New Issue
Block a user