gbytes: Fix check in try_steal_and_unref

Need to check if the user data is equal to the data, before
taking the data out of the GBytes!

Bug #670139.
This commit is contained in:
Christian Persch 2012-02-15 14:42:10 +01:00 committed by Philip Withnall
parent 7895706c82
commit 2bdec0c2f2

View File

@ -407,7 +407,8 @@ try_steal_and_unref (GBytes *bytes,
{
gpointer result;
if (bytes->free_func != free_func || bytes->data == NULL)
if (bytes->free_func != free_func || bytes->data == NULL ||
bytes->user_data != bytes->data)
return NULL;
/* Are we the only reference? */