Skip to content

Commit 351acdf

Browse files
szilagyiadamtdusnoki
authored andcommitted
Add missing release value call for opfunc_addition (#2899)
Right_value wasn't correctly freed in case of an error. Fixes #2894 Fixes #2897 Co-authored-by: Tibor Dusnoki <[email protected]> JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi [email protected]
1 parent e2646f9 commit 351acdf

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

jerry-core/vm/opcodes-ecma-arithmetics.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
145145

146146
if (ECMA_IS_VALUE_ERROR (str_right_value))
147147
{
148+
ecma_free_value (right_value);
148149
ecma_deref_ecma_string (string1_p);
149150
return str_right_value;
150151
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
Array.prototype.unshift(Object(Symbol()));
16+
Array.prototype.reduce(function(p_0, p_1) { return p_0 + p_1}, "");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
object = { valueOf: function ( ) { return Symbol ( "foo" ) } };
16+
assert("" + object);

0 commit comments

Comments
 (0)