summaryrefslogtreecommitdiff
path: root/src/python-systemd/_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/python-systemd/_reader.c')
-rw-r--r--src/python-systemd/_reader.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index 70676aceca..b754014e9b 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -326,8 +326,7 @@ Journal_seek(Journal *self, PyObject *args, PyObject *keywds)
PyErr_SetString(PyExc_ValueError, "Invalid value for whence");
}
- if (result)
- Py_DECREF(result);
+ Py_XDECREF(result);
if (PyErr_Occurred())
return NULL;
Py_RETURN_NONE;
@@ -498,6 +497,8 @@ Journal_iternext(PyObject *self)
Py_ssize_t dict_size;
dict = PyObject_CallMethod(self, "get_next", "");
+ if (PyErr_Occurred())
+ return NULL;
dict_size = PyDict_Size(dict);
if ((int64_t) dict_size > 0LL) {
return dict;