Zero the bucket's memory
Windows doesn't do this automatically.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
//buckets of fun
|
||||
Toy_Bucket* Toy_allocateBucket(unsigned int capacity) {
|
||||
@@ -16,6 +17,8 @@ Toy_Bucket* Toy_allocateBucket(unsigned int capacity) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(bucket, 0, sizeof(Toy_Bucket) + capacity); //zero the memory, to avoid broken header metadata
|
||||
|
||||
//initialize the bucket
|
||||
bucket->next = NULL;
|
||||
bucket->capacity = capacity;
|
||||
|
||||
Reference in New Issue
Block a user