]> git.ipfire.org Git - pakfire.git/commitdiff
_pakfire: Fix multiple issues in a utility function
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 30 Aug 2023 17:28:32 +0000 (17:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 30 Aug 2023 17:28:32 +0000 (17:28 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/util.c

index 085ddcdd43f202bcb001b6f3f9d9cc6faa94c13a..34123ef482ddfa577982bcd6264581ec6203e80f 100644 (file)
@@ -46,16 +46,18 @@ PyObject* PyUnicodeList_FromStringArray(char** l) {
        if (!list)
                goto ERROR;
 
-       while (*l) {
+       for (; *l; l++) {
                s = PyUnicode_FromString(*l);
                if (!s)
                        goto ERROR;
 
                r = PyList_Append(list, s);
+               Py_DECREF(s);
                if (r)
                        goto ERROR;
        }
 
+       return list;
 ERROR:
        if (list)
                Py_DECREF(list);