diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/compat.c | 1 | ||||
-rw-r--r-- | src/or/routerlist.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 924a0394a..e1b7837d0 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -152,6 +152,7 @@ void tor_munmap_file(tor_mmap_t *handle) { munmap((char*)handle->data, handle->size); + tor_free(handle); } #elif defined(MS_WINDOWS) typedef struct win_mmap_t { diff --git a/src/or/routerlist.c b/src/or/routerlist.c index ee324d62b..8363bf219 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -340,6 +340,10 @@ router_reload_router_list(void) router_journal_len = router_store_len = 0; tor_snprintf(fname, fname_len, "%s/cached-routers", options->DataDirectory); + + if (routerlist->mmap_descriptors) /* get rid of it first */ + tor_munmap_file(routerlist->mmap_descriptors); + routerlist->mmap_descriptors = tor_mmap_file(fname); if (routerlist->mmap_descriptors) { router_store_len = routerlist->mmap_descriptors->size; @@ -1262,6 +1266,8 @@ routerlist_free(routerlist_t *rl) signed_descriptor_free(sd)); smartlist_free(rl->routers); smartlist_free(rl->old_routers); + if (routerlist->mmap_descriptors) + tor_munmap_file(routerlist->mmap_descriptors); tor_free(rl); } |