Properly release property name collection in for-in opcode handler (#2875)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
Dániel Bátyai 2019-05-16 15:34:41 +02:00 committed by GitHub
parent fd3e982e69
commit 9a512c8fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -252,7 +252,9 @@ opfunc_for_in (ecma_value_t left_value, /**< left value */
*result_obj_p = ecma_make_object_value (obj_p);
}
jmem_heap_free_block (prop_names_coll_p, sizeof (ecma_collection_header_t));
/* Note: We release the collection header here, and return the chunk list of the collection, which will
* be handled and released by the vm loop. */
jmem_pools_free (prop_names_coll_p, sizeof (ecma_collection_header_t));
ecma_free_value (obj_expr_value);
return prop_names_p;

View File

@ -2816,6 +2816,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
JERRY_ASSERT (!ecma_is_value_pointer (chunk_p->items[index]));
/* TODO: use collection iterator instead of directly accessing the collection chunks. */
*stack_top_p++ = chunk_p->items[index];
index++;