From: Michael Tremer Date: Sat, 22 Feb 2025 15:43:53 +0000 (+0000) Subject: db: Ensure to free the deps list after each iteration X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8a3b88fad4dd718e0a2f4364dd4be04815a8fce;p=pakfire.git db: Ensure to free the deps list after each iteration Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/db.c b/src/pakfire/db.c index 52507fcd..545f8b96 100644 --- a/src/pakfire/db.c +++ b/src/pakfire/db.c @@ -960,6 +960,12 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id, // Reset bound values sqlite3_reset(stmt); } + + // Free the list + if (list) { + pakfire_strings_free(list); + list = NULL; + } } // All okay @@ -968,11 +974,8 @@ static int pakfire_db_add_dependencies(struct pakfire_db* db, unsigned long id, END: if (stmt) sqlite3_finalize(stmt); - if (list) { - for (char** dep = list; *dep; dep++) - free(*dep); - free(list); - } + if (list) + pakfire_strings_free(list); return r; }