]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
writer: Free array with pointer to ASes, too
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 09:28:39 +0000 (09:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 21 Oct 2020 09:30:16 +0000 (09:30 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/writer.c

index 5939cff0fd5cc42ec20e16a10a7c44b89dcb4ad1..160650fa316d1519a8d6705855cebfbedede088c 100644 (file)
@@ -147,8 +147,11 @@ static void loc_writer_free(struct loc_writer* writer) {
                EVP_PKEY_free(writer->private_key2);
 
        // Unref all AS
-       for (unsigned int i = 0; i < writer->as_count; i++) {
-               loc_as_unref(writer->as[i]);
+       if (writer->as) {
+               for (unsigned int i = 0; i < writer->as_count; i++) {
+                       loc_as_unref(writer->as[i]);
+               }
+               free(writer->as);
        }
 
        // Release network tree