summaryrefslogtreecommitdiff
path: root/lib/libX11/src/xlibi18n/lcFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libX11/src/xlibi18n/lcFile.c')
-rw-r--r--lib/libX11/src/xlibi18n/lcFile.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libX11/src/xlibi18n/lcFile.c b/lib/libX11/src/xlibi18n/lcFile.c
index b6cf93f26..060cd83f3 100644
--- a/lib/libX11/src/xlibi18n/lcFile.c
+++ b/lib/libX11/src/xlibi18n/lcFile.c
@@ -626,9 +626,9 @@ _XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name)
Xfree (last_dir_name);
Xfree (last_lc_name);
- last_dir_len = strlen (dir_name) + 1;
- last_dir_name = Xmalloc (last_dir_len);
- strcpy (last_dir_name, dir_name);
+ last_dir_name = strdup (dir_name);
+ last_dir_len = (last_dir_name != NULL) ? strlen (last_dir_name) + 1 : 0;
+
last_lc_name = strdup (lc_name);
return dir_name;
@@ -703,9 +703,9 @@ _XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name)
Xfree (last_dir_name);
Xfree (last_lc_name);
- last_dir_len = strlen (dir_name) + 1;
- last_dir_name = Xmalloc (last_dir_len);
- strcpy (last_dir_name, dir_name);
+ last_dir_name = strdup (dir_name);
+ last_dir_len = (last_dir_name != NULL) ? strlen (last_dir_name) + 1 : 0;
+
last_lc_name = strdup (lc_name);
return dir_name;