[tor-commits] [tor/master] Fix a memory leak in tor-resolve

nickm at torproject.org nickm at torproject.org
Tue Dec 30 17:35:18 UTC 2014


commit 6e689aed756fb3d96fa70e9138aedc93be8f35de
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Dec 30 12:35:01 2014 -0500

    Fix a memory leak in tor-resolve
    
    Resolves bug 14050
---
 ChangeLog            |    2 ++
 src/common/sandbox.c |    7 +++++++
 src/common/sandbox.h |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 4b7f35f..b125d9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -145,6 +145,8 @@ Changes in version 0.2.6.2-alpha - 2014-12-??
     - Make transparent proxy support work along with the seccomp2
       sandbox. Fixes part of bug 13808; bugfix on 0.2.5.1-alpha. Patch
       by Francisco Blas Izquierdo Riera.
+    - Fix a memory leak in tor-resolve when running with the sandbox
+      enabled. Fixes bug 14050; bugfix on 0.2.5.9-rc.
 
   o Minor bugfixes (logging):
     - Downgrade warnings about RSA signature failures to info log level.
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index b1c2a09..a06d386 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -1335,6 +1335,13 @@ sandbox_disable_getaddrinfo_cache(void)
   sandbox_getaddrinfo_cache_disabled = 1;
 }
 
+void
+sandbox_freeaddrinfo(struct addrinfo *ai)
+{
+  if (sandbox_getaddrinfo_cache_disabled)
+    freeaddrinfo(ai);
+}
+
 int
 sandbox_getaddrinfo(const char *name, const char *servname,
                     const struct addrinfo *hints,
diff --git a/src/common/sandbox.h b/src/common/sandbox.h
index ad00186..f1c99ac 100644
--- a/src/common/sandbox.h
+++ b/src/common/sandbox.h
@@ -115,7 +115,7 @@ struct addrinfo;
 int sandbox_getaddrinfo(const char *name, const char *servname,
                         const struct addrinfo *hints,
                         struct addrinfo **res);
-#define sandbox_freeaddrinfo(addrinfo) ((void)0)
+void sandbox_freeaddrinfo(struct addrinfo *addrinfo);
 void sandbox_free_getaddrinfo_cache(void);
 #else
 #define sandbox_getaddrinfo(name, servname, hints, res)  \



More information about the tor-commits mailing list