Changed size_query and destructor call order
This commit is contained in:
parent
bc49570d12
commit
c6ff6ad31d
1 changed files with 3 additions and 3 deletions
|
@ -29,8 +29,8 @@ int TracingHeap_Create(TracingHeap* self, allocator_t* allocator)
|
|||
|
||||
static void _TracingHeap_ForceDestroyObject(TracingHeap* self, TracingObject* object)
|
||||
{
|
||||
self->config.destructor(self->config.destructor_context, object->data);
|
||||
size_t allocated_size = self->config.size_query(self->config.size_query_context, object->data);
|
||||
self->config.destructor(self->config.destructor_context, object->data);
|
||||
Allocator_Free(self->allocator, object, allocated_size);
|
||||
}
|
||||
|
||||
|
@ -166,13 +166,13 @@ size_t TracingHeap_TraceNextN(TracingHeap* self, size_t n)
|
|||
|
||||
static int _TracingHeap_DestroyObject(TracingHeap* self, TracingObject* unreachable_object)
|
||||
{
|
||||
size_t allocated_size = self->config.size_query(self->config.size_query_context, unreachable_object->data);
|
||||
|
||||
int destructor_code = self->config.destructor(self->config.destructor_context, unreachable_object->data);
|
||||
if (destructor_code) {
|
||||
return destructor_code;
|
||||
}
|
||||
|
||||
size_t allocated_size = self->config.size_query(self->config.size_query_context, unreachable_object->data);
|
||||
|
||||
Allocator_Free(self->allocator, unreachable_object, allocated_size);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue