From 41de3c3272abff16995c2053e753d8e72b00a4b7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 26 Mar 2026 14:19:41 -0600 Subject: [PATCH] [vector] Destruct items in clear() when vector is in error state The previous fix (d134f888) zeroed `length` but skipped element destructors. Call shrink_vector(0) instead, which properly destructs items before clearing length. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/hb-vector.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-vector.hh b/src/hb-vector.hh index 9536ab63d..9e31ff332 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -578,7 +578,7 @@ struct hb_vector_t void clear () { if (!resize (0)) - length = 0; /* If resize fails (e.g. vector in error state), still clear length. */ + shrink_vector (0); /* If resize fails (e.g. vector in error state), still destruct items and clear length. */ } template