From: Michael Tremer Date: Sat, 1 Jun 2019 04:20:41 +0000 (+0100) Subject: libpakfire: parser: Free all parts of declarations X-Git-Tag: 0.9.28~1285^2~1003 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2aa4592ba7da7f4c563d17bcef3c7ebbc8b4b12;p=pakfire.git libpakfire: parser: Free all parts of declarations Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser.c b/src/libpakfire/parser.c index 81b216a24..a7c694837 100644 --- a/src/libpakfire/parser.c +++ b/src/libpakfire/parser.c @@ -113,8 +113,18 @@ Pakfire pakfire_parser_get_pakfire(PakfireParser parser) { static void pakfire_parser_free_declarations( struct pakfire_parser_declaration** declarations, unsigned int num) { for (unsigned int i = 0; i < num; i++) { - if (declarations[i]) - pakfire_free(declarations[i]); + struct pakfire_parser_declaration* d = declarations[i]; + + // If we hit NULL, this is the end + if (!d) + break; + + // Free everything + if (d->name) + pakfire_free(d->name); + if (d->value) + pakfire_free(d->value); + pakfire_free(d); } pakfire_free(declarations);