diff --git a/source/toy_bucket.c b/source/toy_bucket.c index 73aa187..ae42a69 100644 --- a/source/toy_bucket.c +++ b/source/toy_bucket.c @@ -4,6 +4,7 @@ #include #include #include +#include //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;