summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-11 11:43:06 +0000
committertron <tron@openttd.org>2006-02-11 11:43:06 +0000
commita90142bb7c51ba3e5fac7cf1f3dd8af014e94cdc (patch)
treeb1d678c0cd5be95c96000ddb8cbad4ca8bf65e34
parentefe76c22e6a980eb8699de8fd93e18b7c2add375 (diff)
downloadopenttd-a90142bb7c51ba3e5fac7cf1f3dd8af014e94cdc.tar.xz
(svn r3590) Fix a bug where sizeof(struct) was allocated instead of sizeof(pointer to struct). This was non-fatal, because more memory than necessary got allocated
-rw-r--r--queue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/queue.c b/queue.c
index 0927c67bd..f6941c935 100644
--- a/queue.c
+++ b/queue.c
@@ -423,7 +423,7 @@ void init_BinaryHeap(Queue* q, uint max_size)
q->data.binaryheap.size = 0;
// We malloc memory in block of BINARY_HEAP_BLOCKSIZE
// It autosizes when it runs out of memory
- q->data.binaryheap.elements = calloc(1, ((max_size - 1) / BINARY_HEAP_BLOCKSIZE*sizeof(BinaryHeapNode)) + 1);
+ q->data.binaryheap.elements = calloc(1, ((max_size - 1) / BINARY_HEAP_BLOCKSIZE*sizeof(*q->data.binaryheap.elements)) + 1);
q->data.binaryheap.elements[0] = malloc(BINARY_HEAP_BLOCKSIZE * sizeof(BinaryHeapNode));
q->data.binaryheap.blocks = 1;
q->freeq = false;