[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] fix a seg fault from tor_free_all



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:
fix a seg fault from tor_free_all


Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -d -r1.212 -r1.213
--- routerlist.c	10 Feb 2005 23:18:39 -0000	1.212
+++ routerlist.c	24 Feb 2005 23:01:26 -0000	1.213
@@ -709,6 +709,7 @@
 /** Free all storage held by a routerlist <b>rl</b> */
 void routerlist_free(routerlist_t *rl)
 {
+  tor_assert(rl);
   SMARTLIST_FOREACH(rl->routers, routerinfo_t *, r,
                     routerinfo_free(r));
   smartlist_free(rl->routers);
@@ -718,7 +719,8 @@
 
 void routerlist_free_current(void)
 {
-  routerlist_free(routerlist);
+  if (routerlist)
+    routerlist_free(routerlist);
   routerlist = NULL;
 }