[glib] gbytes: Fix check in try_steal_and_unref



commit 2bdec0c2f2cde983837ab249c0a9ce05d9d2be53
Author: Christian Persch <chpe gnome org>
Date:   Wed Feb 15 14:42:10 2012 +0100

    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.

 glib/gbytes.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/glib/gbytes.c b/glib/gbytes.c
index a68b17d..ed582c0 100644
--- a/glib/gbytes.c
+++ b/glib/gbytes.c
@@ -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? */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]