gvariant-core: Don’t call posix_memalign() with size==0
While glibc is fine with it (and returns a NULL
pointer), technically
it’s implementation-defined behaviour according to POSIX, so it’s best
avoided.
See https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html.
In particular, valgrind will warn about it, which is causing failures of the gdbus-codegen tests when valgrind is enabled. For example, https://gitlab.gnome.org/GNOME/glib/-/jobs/3460673 gives
==15276== posix_memalign() invalid size value: 0
==15276== at 0x484B7BC: posix_memalign (vg_replace_malloc.c:2099)
==15276== by 0x49320B2: g_variant_new_from_bytes (gvariant-core.c:629)
==15276== by 0x4931853: g_variant_new_from_data (gvariant.c:6226)
==15276== by 0x4B9A951: g_dbus_gvalue_to_gvariant (gdbusutils.c:708)
==15276== by 0x41BD15: _foo_igen_bat_skeleton_handle_get_property (gdbus-test-codegen-generated.c:13503)
==15276== by 0x41BFAF: foo_igen_bat_skeleton_dbus_interface_get_properties (gdbus-test-codegen-generated.c:13582)
…
Signed-off-by: Philip Withnall pwithnall@gnome.org Helps: #3228 (closed)