Fix leak when duplicating blob

This commit is contained in:
Behdad Esfahbod 2010-03-27 17:00:19 -04:00
parent 4b8487d83e
commit 12b27ed91d
1 changed files with 4 additions and 2 deletions

View File

@ -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)