]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
plug another memory leak
authorRoger Dingledine <arma@torproject.org>
Tue, 7 Dec 2004 08:51:10 +0000 (08:51 +0000)
committerRoger Dingledine <arma@torproject.org>
Tue, 7 Dec 2004 08:51:10 +0000 (08:51 +0000)
svn:r3104

src/or/routerlist.c

index 5abca8c14926bd4eda64444fe573e51b56cd0f97..fccd9f9c7c153819b800bc6b4185c42cba94616a 100644 (file)
@@ -450,8 +450,11 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl)
     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;