Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 224003b

Browse files
committed
Add missing DECREF.
1 parent 1f2dac5 commit 224003b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Python/pyarena.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,9 @@ PyArena_Malloc(PyArena *arena, size_t size)
159159
int
160160
PyArena_AddPyObject(PyArena *arena, PyObject *obj)
161161
{
162-
return PyList_Append(arena->a_objects, obj) >= 0;
162+
int r = PyList_Append(arena->a_objects, obj);
163+
if (r >= 0) {
164+
Py_DECREF(obj);
165+
}
166+
return r;
163167
}

0 commit comments

Comments
 (0)