vcl: Don’t leak hb_set_t

Looks like I have a habit of never destroying these.

Change-Id: I58e77908c68553222e34600aafb6fee186000a0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138893
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
diff --git a/vcl/source/font/FeatureCollector.cxx b/vcl/source/font/FeatureCollector.cxx
index 4f517bf..9430a78 100644
--- a/vcl/source/font/FeatureCollector.cxx
+++ b/vcl/source/font/FeatureCollector.cxx
@@ -170,19 +170,21 @@ void FeatureCollector::collectForTable(hb_tag_t aTableTag)
            hb_ot_layout_feature_get_lookups(m_pHbFace, aTableTag, nFeatureIdx, 0, &nLookups,
                                             aLookups.data());
            unsigned int nAlternates = 0;
            hb_set_t* pGlyphs = hb_set_create();
            for (unsigned int nLookupIdx : aLookups)
            {
                hb_set_t* aGlyphs = hb_set_create();
                hb_set_clear(pGlyphs);
                hb_ot_layout_lookup_collect_glyphs(m_pHbFace, aTableTag, nLookupIdx, nullptr,
                                                   aGlyphs, nullptr, nullptr);
                                                   pGlyphs, nullptr, nullptr);
                hb_codepoint_t nGlyphIdx = HB_SET_VALUE_INVALID;
                while (hb_set_next(aGlyphs, &nGlyphIdx))
                while (hb_set_next(pGlyphs, &nGlyphIdx))
                {
                    nAlternates = std::max(
                        nAlternates, hb_ot_layout_lookup_get_glyph_alternates(
                                         m_pHbFace, nLookupIdx, nGlyphIdx, 0, nullptr, nullptr));
                }
            }
            hb_set_destroy(pGlyphs);

            // Append the alternates to the feature parameters, keeping any
            // existing ones calculated from cvXX features above.
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 81f495a..fc28200 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -68,6 +68,8 @@ GenericSalLayout::GenericSalLayout(LogicalFontInstance &rFont)

GenericSalLayout::~GenericSalLayout()
{
    if (mpVertGlyphs)
        hb_set_destroy(mpVertGlyphs);
}

void GenericSalLayout::ParseFeatures(std::u16string_view aName)
@@ -248,6 +250,7 @@ bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationS
                hb_set_union(mpVertGlyphs, pGlyphs);
            }
        }
        hb_set_destroy(pLookups);
    }

    return hb_set_has(mpVertGlyphs, nGlyphIndex) != 0;