]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
writer: Free countries when the writer is being destroyed
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 09:31:29 +0000 (09:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 09:31:29 +0000 (09:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/writer.c

index 160650fa316d1519a8d6705855cebfbedede088c..2f09b56b92c018c448a9861b87e7c8713aa32df6 100644 (file)
@@ -154,6 +154,14 @@ static void loc_writer_free(struct loc_writer* writer) {
                free(writer->as);
        }
 
+       // Unref all countries
+       if (writer->countries) {
+               for (unsigned int i = 0; i < writer->countries_count; i++) {
+                       loc_country_unref(writer->countries[i]);
+               }
+               free(writer->countries);
+       }
+
        // Release network tree
        if (writer->networks)
                loc_network_tree_unref(writer->networks);