Fix memory leak in ecma_op_object_get_enumerable_property_names (#4136)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
This commit is contained in:
committed by
GitHub
parent
ea07052869
commit
409ead7415
@@ -1934,8 +1934,10 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool is_enumerable = (prop_desc.flags & ECMA_PROP_IS_ENUMERABLE) != 0;
|
||||||
|
ecma_free_property_descriptor (&prop_desc);
|
||||||
/* 4.a.ii */
|
/* 4.a.ii */
|
||||||
if ((prop_desc.flags & ECMA_PROP_IS_ENUMERABLE) != 0)
|
if (is_enumerable)
|
||||||
{
|
{
|
||||||
/* 4.a.ii.1 */
|
/* 4.a.ii.1 */
|
||||||
if (option == ECMA_ENUMERABLE_PROPERTY_KEYS)
|
if (option == ECMA_ENUMERABLE_PROPERTY_KEYS)
|
||||||
@@ -1976,11 +1978,6 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ecma_is_value_true (status))
|
|
||||||
{
|
|
||||||
ecma_free_property_descriptor (&prop_desc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,3 +132,15 @@ assert(entries[0][0] === "b");
|
|||||||
assert(entries[0][1] === "bar");
|
assert(entries[0][1] === "bar");
|
||||||
assert(handlers.length === 3);
|
assert(handlers.length === 3);
|
||||||
assert(handlers.toString() === "D,D,G");
|
assert(handlers.toString() === "D,D,G");
|
||||||
|
|
||||||
|
// exception during enumeration
|
||||||
|
var obj = {
|
||||||
|
get a() { throw "error" },
|
||||||
|
get b() { throw "shouldn't run" }
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object.entries(obj);
|
||||||
|
} catch (err) {
|
||||||
|
assert(err == "error")
|
||||||
|
}
|
||||||
|
|||||||
@@ -125,3 +125,15 @@ assert(values.length === 1);
|
|||||||
assert(values[0] === "bar")
|
assert(values[0] === "bar")
|
||||||
assert(handlers.length === 3);
|
assert(handlers.length === 3);
|
||||||
assert(handlers.toString() === "D,D,G");
|
assert(handlers.toString() === "D,D,G");
|
||||||
|
|
||||||
|
// exception during enumeration
|
||||||
|
var obj = {
|
||||||
|
get a() { throw "error" },
|
||||||
|
get b() { throw "shouldn't run" }
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object.values(obj);
|
||||||
|
} catch (err) {
|
||||||
|
assert(err == "error")
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user