]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
fix a seg fault from tor_free_all
authorRoger Dingledine <arma@torproject.org>
Thu, 24 Feb 2005 23:01:26 +0000 (23:01 +0000)
committerRoger Dingledine <arma@torproject.org>
Thu, 24 Feb 2005 23:01:26 +0000 (23:01 +0000)
svn:r3690

src/or/routerlist.c

index db9f08b6d3fb50015936d0cdb90d67e8bb9f7a14..d2de86eb0f4b4fabacc467687aa418d36876ecef 100644 (file)
@@ -709,6 +709,7 @@ routerinfo_t *routerinfo_copy(const routerinfo_t *router)
 /** 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(routerlist_t *rl)
 
 void routerlist_free_current(void)
 {
-  routerlist_free(routerlist);
+  if (routerlist)
+    routerlist_free(routerlist);
   routerlist = NULL;
 }