Mercurial > hg > openttd
changeset 3010:57dba1cf9995 draft
(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
author | tron <tron@openttd.org> |
---|---|
date | Sat, 11 Feb 2006 11:43:06 +0000 |
parents | 7a7378dfb507 |
children | fdfe690f19e9 |
files | queue.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/queue.c +++ b/queue.c @@ -423,7 +423,7 @@ 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;