summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Plotnick <shrike@netaxs.com>2012-03-17 01:32:42 -0400
committerJulien Danjou <julien@danjou.info>2012-03-19 10:11:56 +0100
commit3e9c570c5be43b73882539425b823c12aeba2808 (patch)
treebe020842f870c971a44eb7e262d92ba5ed988bfe
parent3ef6cfd18e57bd7b815c02bd9a52b3baf7a4858f (diff)
Remember to decrement refcount of constructed List elements.
After we append a constructed object to self->list, we no longer need a reference to it. Failing to decrement its refcount results in a memory leak. Signed-off-by: Julien Danjou <julien@danjou.info>
-rw-r--r--src/list.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/list.c b/src/list.c
index 2633685..19b2551 100644
--- a/src/list.c
+++ b/src/list.c
@@ -101,6 +101,7 @@ xpybList_init(xpybList *self, PyObject *args, PyObject *kw)
if (PyList_Append(self->list, obj) < 0)
return -1;
+ Py_DECREF(obj);
}
self->buf = PyBuffer_FromObject(parent, offset, cur - offset);