aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarret Rieger <grieger@google.com>2020-07-29 16:37:39 -0700
committerEbrahim Byagowi <ebrahim@gnu.org>2020-07-30 04:15:35 +0430
commit15644ee60ecebb65fc4d8e6a5b999a3f1629c241 (patch)
tree5b20318e04f3611f56e02b9514ddf71f22e28ac1 /src
parent42237adffcfd951616efc2f8fba2cd195eb002ea (diff)
downloadharfbuzz_ng-15644ee60ecebb65fc4d8e6a5b999a3f1629c241.tar.gz
[ENOMEM] fix memory leak if allocation fails during pop_pack().
Diffstat (limited to 'src')
-rw-r--r--src/hb-serialize.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh
index bac34159c..43aea3897 100644
--- a/src/hb-serialize.hh
+++ b/src/hb-serialize.hh
@@ -256,8 +256,12 @@ struct hb_serialize_context_t
packed.push (obj);
- if (unlikely (packed.in_error ()))
+ if (unlikely (packed.in_error ())) {
+ // obj wasn't successfully added to packed, so clean it up otherwise it's
+ // links will be leaked.
+ obj->fini ();
return 0;
+ }
objidx = packed.length - 1;