[or-cvs] plug another memory leak

Roger Dingledine arma at seul.org
Tue Dec 7 08:51:13 UTC 2004


Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	routerlist.c 
Log Message:
plug another memory leak


Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -d -r1.199 -r1.200
--- routerlist.c	5 Dec 2004 07:10:08 -0000	1.199
+++ routerlist.c	7 Dec 2004 08:51:10 -0000	1.200
@@ -450,8 +450,11 @@
     total_bw += this_bw;
 //    log_fn(LOG_INFO,"Recording bw %d for node %s.", this_bw, router->nickname);
   }
-  if (!total_bw)
+  if (!total_bw) {
+    SMARTLIST_FOREACH(bandwidths, uint32_t*, p, tor_free(p));
+    smartlist_free(bandwidths);
     return smartlist_choose(sl);
+  }
   rand_bw = crypto_pseudo_rand_int(total_bw);
 //  log_fn(LOG_INFO,"Total bw %d. Randomly chose %d.", total_bw, rand_bw);
   tmp = 0;



More information about the tor-commits mailing list