[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8235: stop three memory leaks. nick, fix these if i'm wrong. (in tor/trunk/src: common or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8235: stop three memory leaks. nick, fix these if i'm wrong. (in tor/trunk/src: common or)
- From: arma@xxxxxxxx
- Date: Sat, 26 Aug 2006 22:07:55 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 26 Aug 2006 22:08:02 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
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);
}