From: Michael Tremer Date: Wed, 17 Aug 2022 08:59:58 +0000 (+0000) Subject: python: execute: Fix SEGV when no output has been returned X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e167ed75c13ffabfda3fac7fa8415c91a51ec6a3;p=people%2Fstevee%2Fpakfire.git python: execute: Fix SEGV when no output has been returned Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index 702ed88d..49230294 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -964,10 +964,12 @@ static PyObject* Pakfire_execute(PakfireObject* self, PyObject* args, PyObject* // Did the user request the output? if (return_output) { // Return the buffer as bytes - ret = PyBytes_FromString(output); + if (output) + ret = PyBytes_FromString(output); + } // Otherwise just return None - } else { + if (!ret) { ret = Py_None; Py_INCREF(ret); }