Fix value release in ecma_builtin_typedarray_prototype_map (#3491)

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-01-07 14:25:59 +01:00
committed by Robert Fancsik
parent 420643d645
commit 22e52e45af
2 changed files with 24 additions and 0 deletions
@@ -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
@@ -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);
}