[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r16659: {tor} Fix a memory leak when freeing routerstatuses with exit poli (tor/trunk/src/or)
Author: nickm
Date: 2008-08-25 19:19:58 -0400 (Mon, 25 Aug 2008)
New Revision: 16659
Modified:
tor/trunk/src/or/networkstatus.c
Log:
Fix a memory leak when freeing routerstatuses with exit policy summaries. Patch from mwenge.
Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c 2008-08-25 21:02:44 UTC (rev 16658)
+++ tor/trunk/src/or/networkstatus.c 2008-08-25 23:19:58 UTC (rev 16659)
@@ -233,10 +233,19 @@
return 0;
}
+static void
+vote_routerstatus_free(vote_routerstatus_t *rs)
+{
+ tor_free(rs->version);
+ tor_free(rs->status.exitsummary);
+ tor_free(rs);
+}
+
/** Free all storage held by the routerstatus object <b>rs</b>. */
void
routerstatus_free(routerstatus_t *rs)
{
+ tor_free(rs->exitsummary);
tor_free(rs);
}
@@ -292,13 +301,10 @@
if (ns->routerstatus_list) {
if (ns->type == NS_TYPE_VOTE || ns->type == NS_TYPE_OPINION) {
SMARTLIST_FOREACH(ns->routerstatus_list, vote_routerstatus_t *, rs,
- {
- tor_free(rs->version);
- tor_free(rs);
- });
+ vote_routerstatus_free(rs));
} else {
SMARTLIST_FOREACH(ns->routerstatus_list, routerstatus_t *, rs,
- tor_free(rs));
+ routerstatus_free(rs));
}
smartlist_free(ns->routerstatus_list);