[or-cvs] Try to hunt down a few more leaks

Nick Mathewson nickm at seul.org
Fri Sep 30 21:22:27 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv6634/src/or

Modified Files:
	main.c routerlist.c routerparse.c 
Log Message:
Try to hunt down a few more leaks

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.562
retrieving revision 1.563
diff -u -d -r1.562 -r1.563
--- main.c	30 Sep 2005 20:47:58 -0000	1.562
+++ main.c	30 Sep 2005 21:22:25 -0000	1.563
@@ -1303,7 +1303,8 @@
 tor_init(int argc, char *argv[])
 {
   time_of_process_start = time(NULL);
-  closeable_connection_lst = smartlist_create();
+  if (!closeable_connection_lst)
+    closeable_connection_lst = smartlist_create();
   /* Initialize the history structures. */
   rep_hist_init();
   /* Initialize the service cache. */

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.320
retrieving revision 1.321
diff -u -d -r1.320 -r1.321
--- routerlist.c	30 Sep 2005 21:11:22 -0000	1.320
+++ routerlist.c	30 Sep 2005 21:22:25 -0000	1.321
@@ -93,6 +93,8 @@
         tor_free(s);
       }
     });
+  SMARTLIST_FOREACH(entries, char *, fn, tor_free(fn));
+  smartlist_free(entries);
   networkstatus_list_clean(time(NULL));
   routers_update_all_from_networkstatus();
   return 0;

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- routerparse.c	30 Sep 2005 20:04:55 -0000	1.150
+++ routerparse.c	30 Sep 2005 21:22:25 -0000	1.151
@@ -642,13 +642,11 @@
 router_parse_list_from_string(const char **s, smartlist_t *dest)
 {
   routerinfo_t *router;
-  smartlist_t *routers;
   const char *end;
 
   tor_assert(s);
   tor_assert(*s);
-
-  routers = smartlist_create();
+  tor_assert(dest);
 
   while (1) {
     *s = eat_whitespace(*s);
@@ -670,11 +668,9 @@
       continue;
     }
 
-    smartlist_add(routers, router);
+    smartlist_add(dest, router);
   }
 
-  smartlist_add_all(dest, routers);
-
   return 0;
 }
 



More information about the tor-commits mailing list