database: Free stringpool only after it has been initialised
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Sep 2019 17:45:16 +0000 (17:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Sep 2019 17:45:16 +0000 (17:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c

index fe5e6dc..58e1c00 100644 (file)
@@ -306,7 +306,8 @@ static void loc_database_free(struct loc_database* db) {
                        ERROR(db->ctx, "Could not unmap network nodes section: %s\n", strerror(errno));
        }
 
-       loc_stringpool_unref(db->pool);
+       if (db->pool)
+               loc_stringpool_unref(db->pool);
 
        loc_unref(db->ctx);
        free(db);