bdf2sfd

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

commit 0718aa3dbf073ac58461176e1e10528025d1d32c
parent 692ac05ddb5da7fd419db7018b665b4b46125746
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 20 Jan 2020 23:27:11 +0100

Avoid passing NULL to strdup().

Diffstat:
Msrc/bdftosfd.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/bdftosfd.c b/src/bdftosfd.c @@ -108,7 +108,7 @@ main(int argc, char *argv[]) bool readglyph = false; char *token = NULL; - char *charname = NULL, *encoding = NULL; + char *charname = NULL, *copyright = NULL, *name = NULL, *encoding = NULL; struct fontinfo font; @@ -120,7 +120,10 @@ main(int argc, char *argv[]) token = strtok(lineBuffer, " \t"); if (token) - font.name = strdup(strtok(NULL, "\n")); + name = strtok(NULL, "\n"); + + if (name) + font.name = strdup(name); continue; } @@ -129,7 +132,10 @@ main(int argc, char *argv[]) token = strtok(lineBuffer, " \t"); if (token) - font.copyright = strdup(strtok(NULL, "\n")); + copyright = strtok(NULL, "\n"); + + if (copyright) + font.copyright = strdup(copyright); continue; }