Skip to content

Commit 22e52e4

Browse files
szilagyiadamrerobika
authored andcommitted
Fix value release in ecma_builtin_typedarray_prototype_map (#3491)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
1 parent 420643d commit 22e52e4

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this argument
481481
{
482482
ecma_free_value (current_index);
483483
ecma_free_value (get_value);
484+
ecma_free_value (new_typedarray);
484485
return mapped_value;
485486
}
486487

@@ -490,6 +491,7 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this argument
490491
ecma_free_value (mapped_value);
491492
ecma_free_value (current_index);
492493
ecma_free_value (get_value);
494+
ecma_free_value (new_typedarray);
493495
return ECMA_VALUE_ERROR;
494496
}
495497
else
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
var a = new Float32Array([$])
16+
17+
try {
18+
var $ = a.map(function () { $() });
19+
assert(false);
20+
} catch (e) {
21+
assert(e instanceof TypeError);
22+
}

0 commit comments

Comments
 (0)