mufs: fix Valgrind warnings in mufs_abspath() by using calloc() instead of malloc()

This commit is contained in:
S.J.R. van Schaik 2017-06-14 13:05:54 +02:00
parent 842ee06ee1
commit 13918141c7

View file

@ -17,7 +17,10 @@ char *mufs_abspath(const char *path)
{
char *s, *p, *next, *prev;
if (!(s = malloc(strlen(path) + 2)))
if (!path)
return "/";
if (!(s = calloc(strlen(path) + 2, sizeof *s)))
return NULL;
strcpy(s, path);