From e167ed75c13ffabfda3fac7fa8415c91a51ec6a3 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 17 Aug 2022 08:59:58 +0000 Subject: [PATCH] python: execute: Fix SEGV when no output has been returned Signed-off-by: Michael Tremer --- src/_pakfire/pakfire.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index 702ed88dc..49230294f 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); } -- 2.47.3