[or-cvs] r8235: stop three memory leaks. nick, fix these if i'm wrong. (in tor/trunk/src: common or)
arma at seul.org
arma at seul.org
Sun Aug 27 02:07:55 UTC 2006
Author: arma
Date: 2006-08-26 22:07:54 -0400 (Sat, 26 Aug 2006)
New Revision: 8235
Modified:
tor/trunk/src/common/compat.c
tor/trunk/src/or/routerlist.c
Log:
stop three memory leaks. nick, fix these if i'm wrong.
Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c 2006-08-27 01:41:08 UTC (rev 8234)
+++ tor/trunk/src/common/compat.c 2006-08-27 02:07:54 UTC (rev 8235)
@@ -152,6 +152,7 @@
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 {
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2006-08-27 01:41:08 UTC (rev 8234)
+++ tor/trunk/src/or/routerlist.c 2006-08-27 02:07:54 UTC (rev 8235)
@@ -340,6 +340,10 @@
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 @@
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);
}
More information about the tor-commits
mailing list