[Xcb] [PATCH] Remember to decrement refcount of constructed List elements.

Alex Plotnick shrike at netaxs.com
Fri Mar 16 22:32:42 PDT 2012


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.
---
 src/list.c |    1 +
 1 file changed, 1 insertion(+)

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);
-- 
1.7.9.2



More information about the Xcb mailing list