|
@@ -293,6 +293,8 @@ void *__crt_heap_realloc(__crt_heap_t *heap, void *ptr, size_t alignment, size_t
|
|
|
|
|
|
heap_header_t *new_block = (heap_header_t*)(aligned_start - sizeof(heap_header_t));
|
|
|
memmove(new_block, hole, sizeof(heap_header_t));
|
|
|
+ if (heap->next_offset == (uintptr_t)hole - (uintptr_t)heap->base) heap->next_offset += padding;
|
|
|
+
|
|
|
hole = new_block;
|
|
|
hole->size -= padding;
|
|
|
}
|
|
@@ -332,17 +334,17 @@ void *aligned_alloc(size_t alignment, size_t size)
|
|
|
|
|
|
void *realloc(void *ptr, size_t size)
|
|
|
{
|
|
|
- return __crt_heap_realloc(__crt_default_heap, ptr, 1, size);
|
|
|
+ return __crt_heap_realloc(__crt_default_heap, ptr, sizeof(long), size);
|
|
|
}
|
|
|
|
|
|
void *malloc(size_t size)
|
|
|
{
|
|
|
- return __crt_heap_realloc(__crt_default_heap, NULL, 1, size);
|
|
|
+ return __crt_heap_realloc(__crt_default_heap, NULL, sizeof(long), size);
|
|
|
}
|
|
|
|
|
|
void free(void *ptr)
|
|
|
{
|
|
|
- __crt_heap_realloc(__crt_default_heap, ptr, 1, 0);
|
|
|
+ __crt_heap_realloc(__crt_default_heap, ptr, sizeof(long), 0);
|
|
|
}
|
|
|
|
|
|
void *calloc(size_t nmemb, size_t size)
|