]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix major errors in freeing getaddrinfo sandbox cache
authorNick Mathewson <nickm@torproject.org>
Thu, 1 Dec 2016 15:36:02 +0000 (10:36 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 1 Dec 2016 15:36:02 +0000 (10:36 -0500)
Patch from cypherpunks. Fixes bug 20710; bugfix on 0.2.5.5-alpha.

src/common/sandbox.c

index e43b64b91344809749e880af5af318d4888b6616..1059007771df9f77d1065b90240a25baf943a09c 100644 (file)
@@ -1486,13 +1486,14 @@ sandbox_add_addrinfo(const char *name)
 void
 sandbox_free_getaddrinfo_cache(void)
 {
-  cached_getaddrinfo_item_t **next, **item;
+  cached_getaddrinfo_item_t **next, **item, *this;
 
   for (item = HT_START(getaddrinfo_cache, &getaddrinfo_cache);
        item;
        item = next) {
+    this = *item;
     next = HT_NEXT_RMV(getaddrinfo_cache, &getaddrinfo_cache, item);
-    cached_getaddrinfo_item_free(*item);
+    cached_getaddrinfo_item_free(this);
   }
 
   HT_CLEAR(getaddrinfo_cache, &getaddrinfo_cache);