mirror of
https://github.com/systemd/systemd.git
synced 2026-07-22 23:41:12 +00:00
systemd-python: fix memory leak in _reader and minor bugs
iternext now checks for error from get_next, and changed a DECREF to XDECREF rather than NULL check
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
c71f26eba5
commit
6d0c634ca3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user