diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-01-22 19:13:02 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-01-22 19:13:02 +0000 |
commit | 36620ca0567561ddda6f867440119e705409b3fa (patch) | |
tree | d484b446586085327809751f149c2ad3ba156693 /src/or/dns.c | |
parent | 84790d059fc08bc086104a8ee0486690c0d0adba (diff) | |
download | tor-36620ca0567561ddda6f867440119e705409b3fa.tar.gz tor-36620ca0567561ddda6f867440119e705409b3fa.zip |
r9718@catbus: nickm | 2007-01-22 14:13:00 -0500
Free CACHE_STATE_DONE cached_router_t items on dns_free_all().
svn:r9386
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index ea1df1ac46..537d5ff80a 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -318,6 +318,21 @@ void dns_free_all(void) { cached_resolve_t **ptr, **next, *item; + if (cached_resolve_pqueue) { + SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res, + { + /* XXXX012 The hach lookups here could be quite slow; remove them + * once we're happy. */ + if (res->state == CACHE_STATE_DONE) { + cached_resolve_t *removed = HT_REMOVE(cache_map, &cache_root, res); + tor_assert(!removed); + _free_cached_resolve(res); + } else { + cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res); + tor_assert(found); + } + }); + } for (ptr = HT_START(cache_map, &cache_root); ptr != NULL; ptr = next) { item = *ptr; next = HT_NEXT_RMV(cache_map, &cache_root, ptr); |