bdf2sfd

BDF to SFD converter, allowing to vectorize bitmap fonts
Log | Files | Refs | README | LICENSE

commit 0e193589fec69609f0612a7ece52bd97f44f0741
parent 73246a9c0538a7d98793c1041e7a02e13ae2a88c
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 30 Mar 2020 19:30:43 +0200

Conditionally free font.name and font.psname on exit.

Diffstat:
Msrc/bdf2sfd.c | 15+++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/bdf2sfd.c b/src/bdf2sfd.c @@ -70,6 +70,7 @@ int main(int argc, char *argv[]) { bool readglyph = false; + bool name_allocated = false, psname_allocated = false; char *value = NULL; @@ -163,11 +164,15 @@ main(int argc, char *argv[]) switch(key) { case FAMILY_NAME: - if (!font.name) + if (!font.name) { font.name = strdup(value); + name_allocated = true; + } - if (!font.psname) + if (!font.psname) { font.psname = strdup(value); + psname_allocated = true; + } continue; @@ -296,6 +301,12 @@ main(int argc, char *argv[]) /* Clean up */ fclose(bdfFile); + if (name_allocated) + free(font.name); + + if (psname_allocated) + free(font.psname); + free(font.copyright); free(font.version);