From 6fc06defd55e7d00f620d40e52da47bc4c1b3a96 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 14 Jun 2018 16:50:18 -0600 Subject: * More changes to make Valgrind happy. --- pith/charconv/filesys.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pith/charconv/filesys.c') 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; -- cgit v1.2.3-70-g09d2