diff options
author | marha <marha@users.sourceforge.net> | 2014-01-05 17:18:15 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-01-05 17:18:15 +0100 |
commit | 0fd65ec557757ec8760a96400a09b8a8a92a7b14 (patch) | |
tree | 961d86d49281cf94e2dc85ffb88c6b1491036338 /mkfontscale | |
parent | 68c12003597662f95eac07ddeee99637f7caa3e5 (diff) | |
parent | 1b37f71714e2ca4af60bd050adbbb7969534dfd6 (diff) | |
download | vcxsrv-0fd65ec557757ec8760a96400a09b8a8a92a7b14.tar.gz vcxsrv-0fd65ec557757ec8760a96400a09b8a8a92a7b14.tar.bz2 vcxsrv-0fd65ec557757ec8760a96400a09b8a8a92a7b14.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
randrproto libXau libxcb mesa mkfontscale pixman git update 5 Jan 2014
Diffstat (limited to 'mkfontscale')
-rw-r--r-- | mkfontscale/list.c | 7 | ||||
-rw-r--r-- | mkfontscale/mkfontscale.c | 24 |
2 files changed, 22 insertions, 9 deletions
diff --git a/mkfontscale/list.c b/mkfontscale/list.c index 1614d9537..320ce20c6 100644 --- a/mkfontscale/list.c +++ b/mkfontscale/list.c @@ -235,7 +235,12 @@ sortList(ListPtr old) int i; int l = listLength(old); ListPtr n; - ListPtr *sorted = malloc(l * sizeof(ListPtr)); + ListPtr *sorted; + + if (l <= 0) + return old; + + sorted = malloc(l * sizeof(ListPtr)); if (sorted == NULL) return old; diff --git a/mkfontscale/mkfontscale.c b/mkfontscale/mkfontscale.c index b01d80a27..a2e96fff0 100644 --- a/mkfontscale/mkfontscale.c +++ b/mkfontscale/mkfontscale.c @@ -494,7 +494,7 @@ safe(const char* s) i++; } - if(safe_flag) return s; + if(safe_flag) return strdup(s); len = i; t = malloc(len + 1); @@ -518,7 +518,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) { ListPtr xlfd = NULL; const char *foundry, *family, *weight, *slant, *sWidth, *adstyle, - *spacing, *full_name; + *spacing, *full_name, *tmp; TT_Header *head; TT_HoriHeader *hhea; TT_OS2 *os2; @@ -586,11 +586,11 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) if(t1info) { if(!family) - family = t1info->family_name; + family = strdup(t1info->family_name); if(!family) - family = t1info->full_name; + family = strdup(t1info->full_name); if(!full_name) - full_name = t1info->full_name; + full_name = strdup(t1info->full_name); if(!foundry) foundry = notice_foundry(t1info->notice); if(!weight) @@ -607,7 +607,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) if(!full_name) { fprintf(stderr, "Couldn't determine full name for %s\n", filename); - full_name = filename; + full_name = strdup(filename); } if(head) { @@ -632,11 +632,13 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) notice = getName(face, TT_NAME_ID_TRADEMARK); if(notice) { foundry = notice_foundry(notice); + free(notice); } if(!foundry) { notice = getName(face, TT_NAME_ID_MANUFACTURER); if(notice) { foundry = notice_foundry(notice); + free(notice); } } } @@ -654,7 +656,7 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) if(!foundry) foundry = "misc"; if(!family) { fprintf(stderr, "Couldn't get family name for %s\n", filename); - family = filename; + family = strdup(filename); } if(!weight) weight = "medium"; @@ -663,9 +665,11 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) if(!adstyle) adstyle = ""; if(!spacing) spacing = "p"; - /* Yes, it's a memory leak. */ foundry = safe(foundry); + + tmp = family; family = safe(family); + free((void *)tmp); if(!isBitmap) { xlfd = listConsF(xlfd, @@ -688,6 +692,10 @@ makeXLFD(char *filename, FT_Face face, int isBitmap) spacing, 60); } } + + free((void *)family); + free((void *)foundry); + free((void *)full_name); return xlfd; } |