[pango] [HB] Fix leak when duplicating blob



commit 5f32f21772954f40d337a1e60299be47fc8be572
Author: Behdad Esfahbod <behdad behdad org>
Date:   Sat Mar 27 17:00:19 2010 -0400

    [HB] Fix leak when duplicating blob

 pango/opentype/hb-blob.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/pango/opentype/hb-blob.c b/pango/opentype/hb-blob.c
index 3348a38..3e787fc 100644
--- a/pango/opentype/hb-blob.c
+++ b/pango/opentype/hb-blob.c
@@ -359,9 +359,11 @@ hb_blob_try_writable (hb_blob_t *blob)
       fprintf (stderr, "%p %s: dupped successfully -> %p\n", blob, __FUNCTION__, blob->data);
 #endif
       memcpy (new_data, blob->data, blob->length);
-      blob->data = new_data;
-      blob->mode = HB_MEMORY_MODE_WRITABLE;
       _hb_blob_destroy_user_data (blob);
+      blob->mode = HB_MEMORY_MODE_WRITABLE;
+      blob->data = new_data;
+      blob->destroy = free;
+      blob->user_data = new_data;
     }
   }
   else if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE)



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