diff options
-rw-r--r-- | tools/lib/h5tools_str.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 795107a..0de126d 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1395,10 +1395,10 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac head = newstr; while ( (tok = strstr ( head, substr ))){ oldstr = newstr; - newstr = malloc ( strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) + 1 ); + newstr = HDmalloc ( strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) + 1 ); if ( newstr == NULL ){ - free (oldstr); + HDfree (oldstr); return NULL; } memcpy ( newstr, oldstr, tok - oldstr ); @@ -1407,7 +1407,7 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac memset ( newstr + strlen ( oldstr ) - strlen ( substr ) + strlen ( replacement ) , 0, 1 ); /* move back head right after the last replacement */ head = newstr + (tok - oldstr) + strlen( replacement ); - free (oldstr); + HDfree (oldstr); } return newstr; |