aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/FSWrap.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
commit70ac75f4ab184c21d11b9840a47362610aaef481 (patch)
tree183b9ec7e6897fb2cea7296b461a35ca93dfce6e /nx-X11/lib/X11/FSWrap.c
parent6c303d9e4ffd162b8c7f59a4b135e592d923a656 (diff)
parent70e9d346fe34af127d2c827c3678e53d0f4312ae (diff)
downloadnx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.gz
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.bz2
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.zip
Merge branch 'uli42-pr/libX11_further_backports' into 3.6.x
Attributes GH PR #222: https://github.com/ArcticaProject/nx-libs/pull/222
Diffstat (limited to 'nx-X11/lib/X11/FSWrap.c')
-rw-r--r--nx-X11/lib/X11/FSWrap.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/nx-X11/lib/X11/FSWrap.c b/nx-X11/lib/X11/FSWrap.c
index 35bf33d2a..015965779 100644
--- a/nx-X11/lib/X11/FSWrap.c
+++ b/nx-X11/lib/X11/FSWrap.c
@@ -85,10 +85,9 @@ _XParseBaseFontNameList(
if (!*str)
return (char **)NULL;
- if (!(ptr = Xmalloc((unsigned)strlen(str) + 1))) {
+ if (!(ptr = strdup(str))) {
return (char **)NULL;
}
- strcpy(ptr, str);
psave = ptr;
/* somebody who specifies more than XMAXLIST basefontnames will lose */
@@ -113,7 +112,7 @@ _XParseBaseFontNameList(
if (!*ptr)
break;
}
- if (!(list = (char **) Xmalloc((unsigned)sizeof(char *) * (*num + 1)))) {
+ if (!(list = Xmalloc(sizeof(char *) * (*num + 1)))) {
Xfree(psave);
return (char **)NULL;
}
@@ -131,10 +130,10 @@ copy_string_list(
char **string_list_ret, **list_src, **list_dst, *dst;
int length, count;
- if (string_list == NULL)
+ if (string_list == NULL || list_count <= 0)
return (char **) NULL;
- string_list_ret = (char **) Xmalloc(sizeof(char *) * list_count);
+ string_list_ret = Xmalloc(sizeof(char *) * list_count);
if (string_list_ret == NULL)
return (char **) NULL;
@@ -143,7 +142,7 @@ copy_string_list(
for (length = 0; count-- > 0; list_src++)
length += strlen(*list_src) + 1;
- dst = (char *) Xmalloc(length);
+ dst = Xmalloc(length);
if (dst == NULL) {
Xfree(string_list_ret);
return (char **) NULL;