From ae7f0e83d4417fac2455c44eaea15b3cca03d18e Mon Sep 17 00:00:00 2001 From: Michiharu Ariza Date: Mon, 24 Sep 2018 22:49:44 -0700 Subject: [PATCH] fixed memory leaks in CFF1 & CFF2 accelerators, VORG subsetter --- src/hb-ot-cff1-table.hh | 2 ++ src/hb-ot-cff2-table.hh | 2 ++ src/hb-ot-vorg-table.hh | 3 +++ 3 files changed, 7 insertions(+) diff --git a/src/hb-ot-cff1-table.hh b/src/hb-ot-cff1-table.hh index d90131bd6..30d8c319b 100644 --- a/src/hb-ot-cff1-table.hh +++ b/src/hb-ot-cff1-table.hh @@ -1093,6 +1093,8 @@ struct cff1 sc.end_processing (); topDict.fini (); fontDicts.fini (); + for (unsigned int i = 0; i < privateDicts.len; i++) + privateDicts[i].fini (); privateDicts.fini (); hb_blob_destroy (blob); blob = nullptr; diff --git a/src/hb-ot-cff2-table.hh b/src/hb-ot-cff2-table.hh index 55e256cae..196c73ee8 100644 --- a/src/hb-ot-cff2-table.hh +++ b/src/hb-ot-cff2-table.hh @@ -491,6 +491,8 @@ struct cff2 { sc.end_processing (); fontDicts.fini (); + for (unsigned int i = 0; i < privateDicts.len; i++) + privateDicts[i].fini (); privateDicts.fini (); hb_blob_destroy (blob); blob = nullptr; diff --git a/src/hb-ot-vorg-table.hh b/src/hb-ot-vorg-table.hh index f4d9cc233..db8aed236 100644 --- a/src/hb-ot-vorg-table.hh +++ b/src/hb-ot-vorg-table.hh @@ -129,6 +129,7 @@ struct VORG if (unlikely (!dest)) { subset_metrics.fini (); + hb_blob_destroy (vorg_blob); return false; } @@ -137,6 +138,7 @@ struct VORG { subset_metrics.fini (); free (dest); + hb_blob_destroy (vorg_blob); return false; } @@ -148,6 +150,7 @@ struct VORG bool success = plan->add_table (HB_OT_TAG_VORG, result); hb_blob_destroy (result); subset_metrics.fini (); + hb_blob_destroy (vorg_blob); return success; }