Skip to content

Commit

Permalink
directwrite: fix outdated dealloc code that has become leaky
Browse files Browse the repository at this point in the history
Regression in commit b6650bd:
fullnames and families are no longer allocated, so freeing them
is pointless, wherease extended_family is allocated in their stead
and yet is never freed.
  • Loading branch information
astiob committed Feb 19, 2024
1 parent 58a8f09 commit 3782517
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions libass/ass_directwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,19 +638,8 @@ static void add_font_face(IDWriteFontFace *face, ASS_FontProvider *provider,
ass_font_provider_add_font(provider, &meta, NULL, 0, font_priv);

cleanup:
if (meta.families) {
for (int k = 0; k < meta.n_family; k++)
free(meta.families[k]);
free(meta.families);
}

if (meta.fullnames) {
for (int k = 0; k < meta.n_fullname; k++)
free(meta.fullnames[k]);
free(meta.fullnames);
}

free(meta.postscript_name);
free(meta.extended_family);

if (face)
IDWriteFontFace_Release(face);
Expand Down Expand Up @@ -828,19 +817,8 @@ static void add_font(IDWriteFont *font, IDWriteFontFamily *fontFamily,
ass_font_provider_add_font(provider, &meta, NULL, 0, font_priv);

cleanup:
if (meta.families) {
for (int k = 0; k < meta.n_family; k++)
free(meta.families[k]);
free(meta.families);
}

if (meta.fullnames) {
for (int k = 0; k < meta.n_fullname; k++)
free(meta.fullnames[k]);
free(meta.fullnames);
}

free(meta.postscript_name);
free(meta.extended_family);

if (font)
IDWriteFont_Release(font);
Expand Down

0 comments on commit 3782517

Please sign in to comment.