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:
parent
7f7b05cf05
commit
6ab4de1ddb
|
@ -126,7 +126,7 @@ dos_listdir(dosfs_t *fsd, unsigned int offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
cur->next = malloc(sizeof(dosfile_t));
|
cur->next = calloc(1, sizeof(dosfile_t));
|
||||||
if (cur->next == NULL) {
|
if (cur->next == NULL) {
|
||||||
DPRINTF(("inner malloc failed!?\n"));
|
DPRINTF(("inner malloc failed!?\n"));
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
Loading…
Reference in a new issue