Make all dynamic memory allocations via core API functions in jerry-ext (#4480)
Direct calls to `malloc` and `free` should be avoided, `jerry_heap_alloc` and `jerry_heap_free` should be used in their place. Build-time configuration should decide whether those calls manage dynamic memory on the engine's heap or on the system heap. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -157,7 +157,8 @@ jerryx_handle_scope_alloc (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
jerryx_handle_scope_dynamic_t *dy_scope = malloc (sizeof (jerryx_handle_scope_dynamic_t));
|
||||
jerryx_handle_scope_dynamic_t *dy_scope;
|
||||
dy_scope = (jerryx_handle_scope_dynamic_t *) jerry_heap_alloc (sizeof (jerryx_handle_scope_dynamic_t));
|
||||
JERRYX_ASSERT (dy_scope != NULL);
|
||||
dy_scope->child = NULL;
|
||||
|
||||
@@ -216,7 +217,7 @@ jerryx_handle_scope_free (jerryx_handle_scope_t *scope)
|
||||
{
|
||||
dy_scope->parent->child = dy_scope->child;
|
||||
}
|
||||
free (dy_scope);
|
||||
jerry_heap_free (dy_scope, sizeof (jerryx_handle_scope_dynamic_t));
|
||||
return;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user