mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01: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:
parent
635f8d43eb
commit
1e0cec289c
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user