Skip to content

Commit 3c1ced2

Browse files
Update src/PyListProxyHandler.cc
Co-authored-by: Caleb Aikens <[email protected]>
1 parent 6317604 commit 3c1ced2

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
@@ -362,9 +362,12 @@ static bool array_splice(JSContext *cx, unsigned argc, JS::Value *vp) {
362362
JS::RootedValue elementVal(cx);
363363
for (int index = 0; index < insertCount; index++) {
364364
elementVal.set(args[index + 2].get());
365-
if (PyList_SetItem(inserted, index, pyTypeFactory(cx, elementVal)) < 0) {
365+
PyObject *value = pyTypeFactory(cx, elementVal);
366+
if (PyList_SetItem(inserted, index, value) < 0) {
367+
Py_DECREF(value);
366368
return false;
367369
}
370+
Py_DECREF(value);
368371
}
369372

370373
if (PyList_SetSlice(self, actualStart, actualStart + actualDeleteCount, inserted) < 0) {

0 commit comments

Comments
 (0)