Fix memory leak in jerry_api_set_object_native_handle.

Related issue: #683

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan
2015-11-02 13:49:52 +03:00
parent c81c730129
commit 9194240ada
2 changed files with 27 additions and 7 deletions
+9
View File
@@ -179,6 +179,15 @@ handler_construct (const jerry_api_object_t *function_obj_p,
jerry_api_set_object_field_value (this_p->v_object, (jerry_api_char_t *) "value_field", &args_p[0]);
jerry_api_set_object_native_handle (this_p->v_object,
(uintptr_t) 0x0000000000000000ull,
handler_construct_freecb);
uintptr_t ptr;
bool is_ok = jerry_api_get_object_native_handle (this_p->v_object, &ptr);
JERRY_ASSERT (is_ok && ptr == (uintptr_t) 0x0000000000000000ull);
/* check if setting handle for second time is handled correctly */
jerry_api_set_object_native_handle (this_p->v_object,
(uintptr_t) 0x0012345678abcdefull,
handler_construct_freecb);