summaryrefslogtreecommitdiff
path: root/python/sourcelist.cc
diff options
context:
space:
mode:
Diffstat (limited to 'python/sourcelist.cc')
-rw-r--r--python/sourcelist.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/sourcelist.cc b/python/sourcelist.cc
index 0820d5bf..aceb19ad 100644
--- a/python/sourcelist.cc
+++ b/python/sourcelist.cc
@@ -90,9 +90,12 @@ static PyObject *PkgSourceListGetList(PyObject *Self,void*)
for (vector<metaIndex *>::const_iterator I = list->begin();
I != list->end(); I++)
{
- PyObject *Obj;
- Obj = CppPyObject_NEW<metaIndex*>(&MetaIndexType,*I);
+ CppOwnedPyObject<metaIndex*> *Obj;
+ Obj = CppOwnedPyObject_NEW<metaIndex*>(Self, &MetaIndexType,*I);
+ // Never delete metaIndex*, they are managed by the pkgSourceList.
+ Obj->NoDelete = true;
PyList_Append(List,Obj);
+ Py_DECREF(Obj);
}
return List;
}