summaryrefslogtreecommitdiff
path: root/pith/charconv/filesys.c
diff options
context:
space:
mode:
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;