From 75d016f6a8f4e2c0af5ea85b07c8e29eb939dd71 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 14 Sep 2023 11:49:06 +0000 Subject: [PATCH] _pakfire: util: Fix SEGV when we could not read from file Signed-off-by: Michael Tremer --- src/_pakfire/util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pakfire/util.c b/src/_pakfire/util.c index 4642f8329..e661a178b 100644 --- a/src/_pakfire/util.c +++ b/src/_pakfire/util.c @@ -179,7 +179,8 @@ static ssize_t PyObject_AsFileHandle_read(void* cookie, char* buffer, size_t siz memcpy(buffer, bytes, bytes_read); ERROR: - Py_DECREF(pybuffer); + if (pybuffer) + Py_DECREF(pybuffer); // Release the GIL PyGILState_Release(state); -- 2.39.5