From 2d8ff3bcbe69f9d573f2075ef0e3c3d061f1133f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 19 Nov 2022 15:23:44 -0700 Subject: [PATCH] [unicode] Destroy user_data in set_funcs fail paths This is what the font_funcs / draw_funcs do. --- src/hb-unicode.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index 54c46692c..d1ecef97c 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -379,9 +379,10 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \ if (hb_object_is_immutable (ufuncs)) \ goto fail; \ \ - if (!func && destroy) \ + if (!func) \ { \ - destroy (user_data); \ + if (destroy) \ + destroy (user_data); \ destroy = nullptr; \ user_data = nullptr; \ } \