mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +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
|
||||
* harder here.
|
||||
*/
|
||||
mem = malloc (size);
|
||||
mem = (size > 0) ? malloc (size) : NULL;
|
||||
#endif
|
||||
|
||||
return mem;
|
||||
|
Loading…
Reference in New Issue
Block a user