diff options
Diffstat (limited to 'python/rpmmodule.c')
-rw-r--r-- | python/rpmmodule.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c index c11a91075..04558a834 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -890,19 +890,16 @@ static PyObject * rpmdbNext(rpmdbObject * s, PyObject * args) { static PyObject * handleDbResult(rpmdbMatchIterator mi) { PyObject * list, *o; - if (mi == NULL) { - PyErr_SetString(pyrpmError, "error reading from database"); - return NULL; - } - list = PyList_New(0); /* XXX FIXME: unnecessary header mallocs are side effect here */ - while (rpmdbNextIterator(mi)) { - PyList_Append(list, o=PyInt_FromLong(rpmdbGetIteratorOffset(mi))); - Py_DECREF(o); + if (mi != NULL) { + while (rpmdbNextIterator(mi)) { + PyList_Append(list, o=PyInt_FromLong(rpmdbGetIteratorOffset(mi))); + Py_DECREF(o); + } + rpmdbFreeIterator(mi); } - rpmdbFreeIterator(mi); return list; } |