Property release the callback result in Array.prototype.[find/findIndex] (#3052)

This patch fixes #3049.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-09-05 01:42:16 +02:00
committed by Dániel Bátyai
parent 8bccbbf08f
commit 1c4cfe3e20
2 changed files with 22 additions and 2 deletions
@@ -1992,11 +1992,16 @@ ecma_builtin_array_prototype_object_find (ecma_value_t predicate, /**< callback
return call_value;
}
if (ecma_op_to_boolean (call_value))
bool call_value_to_bool = ecma_op_to_boolean (call_value);
ecma_free_value (call_value);
if (call_value_to_bool)
{
/* 8.f */
if (is_find)
{
ecma_free_value (current_index);
return get_value;
}
@@ -2004,7 +2009,6 @@ ecma_builtin_array_prototype_object_find (ecma_value_t predicate, /**< callback
return current_index;
}
ecma_free_value (call_value);
ecma_free_value (get_value);
ecma_free_value (current_index);
}