Zero memory when allocating list
This commit is contained in:
parent
f72568c135
commit
e622923e19
@ -1,5 +1,7 @@
|
|||||||
#include "list/typed_list.h"
|
#include "list/typed_list.h"
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
list_void_t *_create_list(u64 size, u64 count) {
|
list_void_t *_create_list(u64 size, u64 count) {
|
||||||
@ -13,6 +15,7 @@ list_void_t *_create_list(u64 size, u64 count) {
|
|||||||
munmap(list, sizeof(list_void_t));
|
munmap(list, sizeof(list_void_t));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
memset(list->items, 0, sizeof(size * count));
|
||||||
|
|
||||||
list->capacity = count;
|
list->capacity = count;
|
||||||
list->count = 0;
|
list->count = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user