Fix memory leak in ecma_op_abstract_relational_compare (#4235)

Fixes #4234.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
This commit is contained in:
Csaba Osztrogonác
2020-09-28 10:29:25 +02:00
committed by GitHub
parent f58f15077f
commit c4388e2c19
2 changed files with 50 additions and 9 deletions
+8 -9
View File
@@ -391,14 +391,11 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ecma_number_t nx;
ecma_number_t ny;
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)))
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx))
|| ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
{
return ECMA_VALUE_ERROR;
}
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
{
return ECMA_VALUE_ERROR;
ret_value = ECMA_VALUE_ERROR;
goto end;
}
/* b. */
@@ -513,9 +510,10 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
else
{
ecma_number_t ny;
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py,&ny)))
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
{
return ECMA_VALUE_ERROR;
ret_value = ECMA_VALUE_ERROR;
goto end;
}
if (ecma_number_is_nan (ny))
@@ -552,6 +550,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ret_value = ecma_make_boolean_value (is_px_less);
}
end:
ecma_free_value (prim_second_converted_value);
ecma_free_value (prim_first_converted_value);