From: Roger Dingledine Date: Thu, 24 Feb 2005 23:01:26 +0000 (+0000) Subject: fix a seg fault from tor_free_all X-Git-Tag: tor-0.1.0.1-rc~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6329811a8804ff6755727a32e7da4b8ea17593fd;p=thirdparty%2Ftor.git fix a seg fault from tor_free_all svn:r3690 --- diff --git a/src/or/routerlist.c b/src/or/routerlist.c index db9f08b6d3..d2de86eb0f 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -709,6 +709,7 @@ routerinfo_t *routerinfo_copy(const routerinfo_t *router) /** Free all storage held by a routerlist rl */ 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; }