dosfs: use calloc instead of malloc

calloc zeroes out the memory it allocates, which helps avoid
segfaults related to linked list traversal.
This commit is contained in:
snow flurry 2020-11-17 12:58:11 -08:00
parent 7f7b05cf05
commit 6ab4de1ddb

View file

@ -126,7 +126,7 @@ dos_listdir(dosfs_t *fsd, unsigned int offset)
}
if (i > 0) {
cur->next = malloc(sizeof(dosfile_t));
cur->next = calloc(1, sizeof(dosfile_t));
if (cur->next == NULL) {
DPRINTF(("inner malloc failed!?\n"));
res = -1;