diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp index c85b09c530959..35f82a85b9f04 100644 --- a/core/jni/android/graphics/TextLayoutCache.cpp +++ b/core/jni/android/graphics/TextLayoutCache.cpp @@ -992,6 +992,10 @@ HB_Face TextLayoutShaper::getCachedHBFace(SkTypeface* typeface) { } void TextLayoutShaper::purgeCaches() { + size_t cacheSize = mCachedHBFaces.size(); + for (size_t i = 0; i < cacheSize; i++) { + HB_FreeFace(mCachedHBFaces.valueAt(i)); + } mCachedHBFaces.clear(); unrefTypefaces(); init();