[tor-bugs] #20710 [Core Tor/Tor]: memory leak in sandbox_getaddrinfo()
Tor Bug Tracker & Wiki
blackhole at torproject.org
Fri Nov 18 16:50:10 UTC 2016
#20710: memory leak in sandbox_getaddrinfo()
--------------------------+------------------------------------
Reporter: arma | Owner:
Type: defect | Status: new
Priority: Medium | Milestone: Tor: 0.2.9.x-final
Component: Core Tor/Tor | Version: Tor: 0.2.5.5-alpha
Severity: Normal | Resolution:
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
--------------------------+------------------------------------
Changes (by cypherpunks):
* version: Tor: 0.2.9.5-alpha => Tor: 0.2.5.5-alpha
Comment:
The function was added in commit e425fc78045f99725d256956acc7360ed71bfaa5
which was included in version 0.2.5.5-alpha. Using a temporary variable to
store the current item seems to be the solution.
{{{
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 24ba8a2..ebc843e 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -1579,13 +1579,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);
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20710#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list