Fix leak when duplicating blob
This commit is contained in:
parent
4b8487d83e
commit
12b27ed91d
|
@ -366,9 +366,11 @@ hb_blob_try_writable (hb_blob_t *blob)
|
||||||
fprintf (stderr, "%p %s: dupped successfully -> %p\n", blob, __FUNCTION__, blob->data);
|
fprintf (stderr, "%p %s: dupped successfully -> %p\n", blob, __FUNCTION__, blob->data);
|
||||||
#endif
|
#endif
|
||||||
memcpy (new_data, blob->data, blob->length);
|
memcpy (new_data, blob->data, blob->length);
|
||||||
blob->data = new_data;
|
|
||||||
blob->mode = HB_MEMORY_MODE_WRITABLE;
|
|
||||||
_hb_blob_destroy_user_data (blob);
|
_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)
|
else if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE)
|
||||||
|
|
Loading…
Reference in New Issue