]> git.ipfire.org Git - pakfire.git/commitdiff
Fix a memory leak in generation of a list.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Jan 2012 16:53:31 +0000 (17:53 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 28 Jan 2012 16:53:31 +0000 (17:53 +0100)
python/src/repo.c

index a869d6e0faa3f067f40ccbacbccd905ac9283354..6621c3bff955659729230942bddd70cb87affd4a 100644 (file)
@@ -188,6 +188,9 @@ PyObject *Repo_get_all(RepoObject *self) {
        Id p;
        Repo *r = self->_repo;
 
+       assert(r != NULL);
+       assert(r->pool != NULL);
+
        PyObject *list = PyList_New(0);
 
        FOR_REPO_SOLVABLES(r, p, s) {
@@ -197,12 +200,12 @@ PyObject *Repo_get_all(RepoObject *self) {
                if (solv == NULL)
                        return NULL;
 
-               solv->_pool = self->_repo->pool;
+               solv->_pool = r->pool;
                solv->_id = p;
 
                PyList_Append(list, (PyObject *)solv);
+               Py_DECREF(solv);
        }
 
-       Py_INCREF(list);
        return list;
 }