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

tags/0.1.0
S.J.R. van Schaik 7 years ago
parent 842ee06ee1
commit 13918141c7
  1. 5
      source/fs/mufs/dir.c

@ -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);

Loading…
Cancel
Save