]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: parser: Free all parts of declarations
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jun 2019 04:20:41 +0000 (05:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 1 Jun 2019 04:20:41 +0000 (05:20 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser.c

index 81b216a24bde887fc43219be47e5ea63225746c5..a7c69483785f07de34af13c296b1f4eb9961c798 100644 (file)
@@ -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);