From e425fc78045f99725d256956acc7360ed71bfaa5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 22 May 2014 17:39:36 -0400 Subject: sandbox: revamp sandbox_getaddrinfo cacheing The old cache had problems: * It needed to be manually preloaded. (It didn't remember any address you didn't tell it to remember) * It was AF_INET only. * It looked at its cache even if the sandbox wasn't turned on. * It couldn't remember errors. * It had some memory management problems. (You can't use memcpy to copy an addrinfo safely; it has pointers in.) This patch fixes those issues, and moves to a hash table. Fixes bug 11970; bugfix on 0.2.5.1-alpha. --- src/common/address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/address.c') diff --git a/src/common/address.c b/src/common/address.c index 2825b123d..29d4c0447 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -264,7 +264,7 @@ tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr) &((struct sockaddr_in6*)best->ai_addr)->sin6_addr); result = 0; } - freeaddrinfo(res); + sandbox_freeaddrinfo(res); return result; } return (err == EAI_AGAIN) ? 1 : -1; -- cgit v1.2.3