diff options
author | Roger Dingledine <arma@torproject.org> | 2006-08-27 02:07:54 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-08-27 02:07:54 +0000 |
commit | 9f5856c03da9f8c1ae381046d6929cdc9d6d3004 (patch) | |
tree | b6f3f977b5f19b7ee38901fd068d3e370795cc4e /src | |
parent | 24ad1e06cf2ff1f37483faa6f882cfda249a3ac2 (diff) | |
download | tor-9f5856c03da9f8c1ae381046d6929cdc9d6d3004.tar.gz tor-9f5856c03da9f8c1ae381046d6929cdc9d6d3004.zip |
stop three memory leaks. nick, fix these if i'm wrong.
svn:r8235
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 924a0394a3..e1b7837d0c 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 ee324d62bb..8363bf219f 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); } |