summaryrefslogtreecommitdiff
path: root/pith/charconv/filesys.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-06-14 16:50:18 -0600
committerEduardo Chappa <chappa@washington.edu>2018-06-14 16:50:18 -0600
commit6fc06defd55e7d00f620d40e52da47bc4c1b3a96 (patch)
tree8a6c410b0f9280f1b218358ac34178d506b104b6 /pith/charconv/filesys.c
parent992277048fb4c5f380edb8e9247b7e721662ca89 (diff)
downloadalpine-6fc06defd55e7d00f620d40e52da47bc4c1b3a96.tar.xz
* More changes to make Valgrind happy.
Diffstat (limited to 'pith/charconv/filesys.c')
-rw-r--r--pith/charconv/filesys.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pith/charconv/filesys.c b/pith/charconv/filesys.c
index fe989aff..2515c99a 100644
--- a/pith/charconv/filesys.c
+++ b/pith/charconv/filesys.c
@@ -56,6 +56,11 @@ fname_to_locale(char *fname)
static size_t fname_locale_len = 0;
char *converted_fname, *p;
+ if(fname == NULL){ /* special call to free memory */
+ if(fname_locale_buf) fs_give((void **) &fname_locale_buf);
+ return NULL;
+ }
+
p = convert_to_locale(fname);
if(p)
converted_fname = p;
@@ -103,6 +108,11 @@ fname_to_utf8(char *fname)
static size_t fname_utf8_len = 0;
char *converted_fname, *p;
+ if(fname == NULL){ /* special call to free memory */
+ if(fname_utf8_buf) fs_give((void **) &fname_utf8_buf);
+ return NULL;
+ }
+
p = convert_to_utf8(fname, NULL, 0);
if(p)
converted_fname = p;