fix a seg fault from tor_free_all

svn:r3690
This commit is contained in:
Roger Dingledine 2005-02-24 23:01:26 +00:00
parent 59b1b7770c
commit 6329811a88

View 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,6 +719,7 @@ void routerlist_free(routerlist_t *rl)
void routerlist_free_current(void)
{
if (routerlist)
routerlist_free(routerlist);
routerlist = NULL;
}