mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Merge branch 'wip/hughsie/gbytes-null' into 'main'
glib/gbytes: Be more careful when saving a GBytes of NULL See merge request GNOME/glib!4406
This commit is contained in:
commit
b21bc8d49f
@ -128,7 +128,7 @@ g_bytes_new (gconstpointer data,
|
||||
GBytesInline *bytes;
|
||||
|
||||
bytes = g_malloc (sizeof *bytes + size);
|
||||
bytes->bytes.data = bytes->inline_data;
|
||||
bytes->bytes.data = data != NULL ? bytes->inline_data : NULL;
|
||||
bytes->bytes.size = size;
|
||||
bytes->bytes.free_func = NULL;
|
||||
bytes->bytes.user_data = NULL;
|
||||
|
@ -451,6 +451,7 @@ test_null (void)
|
||||
gsize size;
|
||||
|
||||
bytes = g_bytes_new (NULL, 0);
|
||||
g_assert_null (g_bytes_get_data (bytes, NULL));
|
||||
|
||||
data = g_bytes_unref_to_data (bytes, &size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user