From 12b27ed91de0192deee4e9feffcaf4aca4c78113 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 27 Mar 2010 17:00:19 -0400 Subject: [PATCH] Fix leak when duplicating blob --- src/hb-blob.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.c b/src/hb-blob.c index b4eccb647..3afad8a74 100644 --- a/src/hb-blob.c +++ b/src/hb-blob.c @@ -366,9 +366,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)