memory not freed

Reported directly by feedback form.

Changes from a recent pull request resulted in more array entries
than MAX_GLYPH, so the for loop in free_glyphid_cache() wasn't going far
enough, leaving some dupstr() strings unfreed.
This commit is contained in:
nhmall
2022-12-23 16:38:53 -05:00
parent 91e2ab13b2
commit bfe668c7ef

View File

@@ -371,14 +371,14 @@ init_glyph_cache(void)
void free_glyphid_cache(void)
{
int glyph;
size_t idx;
if (!glyphid_cache)
return;
for (glyph = 0; glyph < MAX_GLYPH; ++glyph) {
if (glyphid_cache[glyph].id) {
free(glyphid_cache[glyph].id);
glyphid_cache[glyph].id = (char *) 0;
for (idx = 0; idx < glyphid_cache_size; ++idx) {
if (glyphid_cache[idx].id) {
free(glyphid_cache[idx].id);
glyphid_cache[idx].id = (char *) 0;
}
}
free(glyphid_cache);