Skip to content

Commit e61f41a

Browse files
author
Zsolt Borbély
committed
Fix of memory leak in Function.prototype.bind function.
Related issue: #511 JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
1 parent 2630048 commit e61f41a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

jerry-core/ecma/base/ecma-helpers.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,8 +801,13 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
801801
case ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_0_31: /* an integer (bit-mask) */
802802
case ECMA_INTERNAL_PROPERTY_NON_INSTANTIATED_BUILT_IN_MASK_32_63: /* an integer (bit-mask) */
803803
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_TARGET_FUNCTION:
804+
{
805+
break;
806+
}
807+
804808
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_THIS:
805809
{
810+
ecma_free_value (property_value, false);
806811
break;
807812
}
808813

tests/jerry/function-prototype-bind.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ assert (foo == 3);
115115
assert (foo instanceof Number);
116116
assert (foo.prototype === undefined);
117117

118+
var func = Number.prototype.toString.bind('foo');
119+
assert (func instanceof Function);
120+
118121
try {
119122
var this_obj = this.constructor;
120123
var bound = this_obj.bind(null, "foo");

0 commit comments

Comments
 (0)