Skip to content

Commit 525f530

Browse files
Update src/PyListProxyHandler.cc
Co-authored-by: Caleb Aikens <[email protected]>
1 parent 62b9766 commit 525f530

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/PyListProxyHandler.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,12 @@ static bool array_push(JSContext *cx, unsigned argc, JS::Value *vp) { // surely
112112
JS::RootedValue elementVal(cx);
113113
for (unsigned index = 0; index < numArgs; index++) {
114114
elementVal.set(args[index].get());
115-
if (PyList_Append(self, pyTypeFactory(cx, elementVal)) < 0) {
115+
PyObject *value = pyTypeFactory(cx, elementVal);
116+
if (PyList_Append(self, value) < 0) {
117+
Py_DECREF(value);
116118
return false;
117119
}
120+
Py_DECREF(value);
118121
}
119122

120123
args.rval().setInt32(PyList_GET_SIZE(self));

0 commit comments

Comments
 (0)