]> git.ipfire.org Git - location/libloc.git/commitdiff
database: Do not clean up python list
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Nov 2020 18:34:51 +0000 (18:34 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Nov 2020 18:34:51 +0000 (18:34 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/database.c

index 38a804cd8a8936e925601498f0c52c3fc1e3f6b5..ed222759102b5b2ae5bb44c5c5c2447630320b1e 100644 (file)
@@ -325,9 +325,14 @@ static PyObject* Database_search_networks(DatabaseObject* self, PyObject* args,
                        loc_country_unref(country);
                }
 
-               loc_database_enumerator_set_countries(enumerator, countries);
+               r = loc_database_enumerator_set_countries(enumerator, countries);
+               if (r) {
+                       PyErr_SetFromErrno(PyExc_SystemError);
+
+                       loc_as_list_unref(countries);
+                       return NULL;
+               }
 
-               Py_DECREF(country_codes);
                loc_country_list_unref(countries);
        }