]> git.ipfire.org Git - location/libloc.git/blobdiff - src/writer.c
writer: Free array with pointer to ASes, too
[location/libloc.git] / 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