From cc9bb294919e846ef8a0731b5e9f304f95ef3bb8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 20 Jun 2021 18:47:03 -0600 Subject: [PATCH] [blob] Fix-up recent mistake in hb_blob_create() destroy(user_data) https://github.com/harfbuzz/harfbuzz/pull/3026#discussion_r653437491 --- src/hb-blob.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 4924eba75..4939bf2ff 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -73,7 +73,11 @@ hb_blob_create (const char *data, hb_destroy_func_t destroy) { if (!length) + { + if (destroy) + destroy (user_data); return hb_blob_get_empty (); + } hb_blob_t *blob = hb_blob_create_or_fail (data, length, mode, user_data, destroy);