mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
jscript: Fixed handling block_cnt in jsheap_alloc.
This commit is contained in:
parent
a2ca48127b
commit
18ee50e5d2
@ -83,25 +83,25 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size)
|
||||
heap->block_cnt = 1;
|
||||
}
|
||||
|
||||
if(heap->offset + size < block_size(heap->last_block)) {
|
||||
if(heap->offset + size <= block_size(heap->last_block)) {
|
||||
tmp = ((BYTE*)heap->blocks[heap->last_block])+heap->offset;
|
||||
heap->offset += size;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if(size < block_size(heap->last_block+1)) {
|
||||
if(size <= block_size(heap->last_block+1)) {
|
||||
if(heap->last_block+1 == heap->block_cnt) {
|
||||
tmp = heap_realloc(heap->blocks, (heap->block_cnt+1)*sizeof(void*));
|
||||
if(!tmp)
|
||||
return NULL;
|
||||
heap->blocks = tmp;
|
||||
}
|
||||
|
||||
tmp = heap_alloc(block_size(heap->block_cnt+1));
|
||||
if(!tmp)
|
||||
heap->blocks = tmp;
|
||||
heap->blocks[heap->block_cnt] = heap_alloc(block_size(heap->block_cnt));
|
||||
if(!heap->blocks[heap->block_cnt])
|
||||
return NULL;
|
||||
|
||||
heap->blocks[heap->block_cnt++] = tmp;
|
||||
heap->block_cnt++;
|
||||
}
|
||||
|
||||
heap->last_block++;
|
||||
heap->offset = size;
|
||||
|
Loading…
Reference in New Issue
Block a user