chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c71f26e
)
systemd-python: fix memory leak in _reader and minor bugs
author
Steven Hiscocks
<steven@hiscocks.me.uk>
Sun, 17 Feb 2013 14:27:59 +0000
(14:27 +0000)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Fri, 22 Feb 2013 15:57:44 +0000
(16:57 +0100)
iternext now checks for error from get_next, and changed a DECREF to
XDECREF rather than NULL check
src/python-systemd/_reader.c
patch
|
blob
|
history
diff --git
a/src/python-systemd/_reader.c
b/src/python-systemd/_reader.c
index 70676acecae85beb86360d79b7fb1795ad70bd89..b754014e9bc50d8a27bceac0ecdf5a3ba03a4182 100644
(file)
--- 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;