diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c index b950c50a4..57c242598 100644 --- a/hw/dmx/dmxinit.c +++ b/hw/dmx/dmxinit.c @@ -800,20 +800,17 @@ void InitOutput(ScreenInfo *pScreenInfo, int argc, char *argv[]) /* RATS: Assuming the fp string (which comes from the command-line argv vector) is NULL-terminated, the buffer is large enough for the strcpy. */ -static void dmxSetDefaultFontPath(char *fp) +static void dmxSetDefaultFontPath(const char *fp) { - int fplen = strlen(fp) + 1; - if (dmxFontPath) { - int len; + int fplen = strlen(fp) + 1; + int len = strlen(dmxFontPath); - len = strlen(dmxFontPath); dmxFontPath = realloc(dmxFontPath, len+fplen+1); dmxFontPath[len] = ','; strncpy(&dmxFontPath[len+1], fp, fplen); } else { - dmxFontPath = malloc(fplen); - strncpy(dmxFontPath, fp, fplen); + dmxFontPath = strdup(fp); } defaultFontPath = dmxFontPath;