diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c index ed08b94b3..bb9c0fd72 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c @@ -481,6 +481,7 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this argument { ecma_free_value (current_index); ecma_free_value (get_value); + ecma_free_value (new_typedarray); return mapped_value; } @@ -490,6 +491,7 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this argument ecma_free_value (mapped_value); ecma_free_value (current_index); ecma_free_value (get_value); + ecma_free_value (new_typedarray); return ECMA_VALUE_ERROR; } else diff --git a/tests/jerry/es2015/regression-test-issue-3485.js b/tests/jerry/es2015/regression-test-issue-3485.js new file mode 100644 index 000000000..026164e9d --- /dev/null +++ b/tests/jerry/es2015/regression-test-issue-3485.js @@ -0,0 +1,22 @@ +// Copyright JS Foundation and other contributors, http://js.foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +var a = new Float32Array([$]) + +try { + var $ = a.map(function () { $() }); + assert(false); +} catch (e) { + assert(e instanceof TypeError); +}