From: Michael Tremer Date: Mon, 5 Jul 2021 17:16:03 +0000 (+0000) Subject: _pakfire: Do not allocate an empty array X-Git-Tag: 0.9.28~1107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb3f13aa5bf262a0d224bea6b6944bf4de8515f3;p=pakfire.git _pakfire: Do not allocate an empty array It is easier to check for NULL Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index 8a8155596..de87c3e35 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -221,6 +221,8 @@ static int convert_packages(PyObject* object, void* address) { } const unsigned int length = PySequence_Length(object); + if (!length) + return Py_CLEANUP_SUPPORTED; // Allocate array *packages = calloc(length + 1, sizeof(*packages));