Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions util1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,8 @@ void *expand_item_list(item_list *lp, size_t item_size, const char *desc, int in
new_ptr == lp->items ? " not" : "");
}

memset((char *)new_ptr + lp->malloced * item_size, 0,
(expand_size - lp->malloced) * item_size);
lp->items = new_ptr;
lp->malloced = expand_size;
}
Expand Down
4 changes: 1 addition & 3 deletions util2.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line)
who_am_i(), do_big_num(max_alloc, 0, NULL), src_file(file), line);
exit_cleanup(RERR_MALLOC);
}
if (!ptr)
ptr = malloc(num * size);
else if (ptr == do_calloc)
if (!ptr || ptr == do_calloc)
ptr = calloc(num, size);
else
ptr = realloc(ptr, num * size);
Expand Down
Loading