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:
Akos Kiss
2021-01-18 18:07:07 +01:00
committed by GitHub
parent b313824228
commit 1d42d17ab6
2 changed files with 7 additions and 6 deletions
@@ -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;
}
/**