From c5dd81cf76569b6b4dca7ac6b7d1f3a19fa2331e Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Fri, 5 Sep 2014 20:28:02 +0400 Subject: [PATCH] Fixing memory leak in opfunc_throw. --- src/libcoreint/opcodes.c | 2 +- tests/unit/test_try_catch.c | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libcoreint/opcodes.c b/src/libcoreint/opcodes.c index 6f0580528..88c33fb44 100644 --- a/src/libcoreint/opcodes.c +++ b/src/libcoreint/opcodes.c @@ -1486,7 +1486,7 @@ opfunc_throw (opcode_t opdata, /**< operation data */ false), ret_value); - return ecma_make_throw_completion_value (ecma_copy_value (var_value.u.value, true)); + ret_value = ecma_make_throw_completion_value (ecma_copy_value (var_value.u.value, true)); ECMA_FINALIZE (var_value); diff --git a/tests/unit/test_try_catch.c b/tests/unit/test_try_catch.c index 904a3dac3..3943264cd 100644 --- a/tests/unit/test_try_catch.c +++ b/tests/unit/test_try_catch.c @@ -60,6 +60,10 @@ main( int __unused argc, init_int( test_program); - return run_int() ? 0 - : 1; + bool is_ok = run_int(); + + serializer_free (); + mem_finalize (false); + + return (is_ok ? 0 : 1); } /* main */