Zero the bucket's memory

Windows doesn't do this automatically.
This commit is contained in:
2026-05-09 12:57:57 +10:00
parent 8b9b012bcc
commit 3b813da1cf
+3
View File
@@ -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;