Commit 06b88d93 authored by Michael Tremer's avatar Michael Tremer

database: Do not try to unmap failed mappings

Signed-off-by: default avatarMichael Tremer <michael.tremer@ipfire.org>
parent bee8c9b3
......@@ -433,28 +433,28 @@ static void loc_database_free(struct loc_database* db) {
DEBUG(db->ctx, "Releasing database %p\n", db);
// Removing all ASes
if (db->as_v1) {
if (db->as_v1 && db->as_v1 != MAP_FAILED) {
r = munmap(db->as_v1, db->as_count * sizeof(*db->as_v1));
if (r)
ERROR(db->ctx, "Could not unmap AS section: %m\n");
}
// Remove mapped network sections
if (db->networks_v1) {
if (db->networks_v1 && db->networks_v1 != MAP_FAILED) {
r = munmap(db->networks_v1, db->networks_count * sizeof(*db->networks_v1));
if (r)
ERROR(db->ctx, "Could not unmap networks section: %m\n");
}
// Remove mapped network nodes section
if (db->network_nodes_v1) {
if (db->network_nodes_v1 && db->network_nodes_v1 != MAP_FAILED) {
r = munmap(db->network_nodes_v1, db->network_nodes_count * sizeof(*db->network_nodes_v1));
if (r)
ERROR(db->ctx, "Could not unmap network nodes section: %m\n");
}
// Remove mapped countries section
if (db->countries_v1) {
if (db->countries_v1 && db->countries_v1 != MAP_FAILED) {
r = munmap(db->countries_v1, db->countries_count * sizeof(*db->countries_v1));
if (r)
ERROR(db->ctx, "Could not unmap countries section: %m\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment