[systemd-devel] Native journald logging for Python

David Strauss david at davidstrauss.net
Tue Jun 26 11:29:33 PDT 2012


Fixed on GitHub:

diff --git a/journald.c b/journald.c
index 0efc223..b106c52 100644
--- a/journald.c
+++ b/journald.c
@@ -17,6 +17,12 @@ journald_send(PyObject *self, PyObject *args) {
     for (i = 0; i < argc; ++i) {
         PyObject *item = PyTuple_GetItem(args, i);
         char * stritem = PyString_AsString(item);
+        if (stritem == NULL) {
+            // PyString_AsString has already raised TypeError at this
+            // point. We can just free iov and return NULL.
+            free(iov);
+            return NULL;
+        }
         iov[i].iov_base = stritem;
         iov[i].iov_len = strlen(stritem);
     }

-- 
David Strauss
   | david at davidstrauss.net


More information about the systemd-devel mailing list