summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-02 12:00:53 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-02 12:00:53 -0500
commitd7ec1708b1a6bc659e5671463dc493fcf0a9f482 (patch)
tree87689955bc5867684604aede3796a5a1db643a94
parent0ef5b8de748709a6aeed1cc6ab21414930239639 (diff)
parent8b93cbc16d2ec0b64ce9d48482a2cf2164ed1199 (diff)
downloadtor-d7ec1708b1a6bc659e5671463dc493fcf0a9f482.tar.gz
tor-d7ec1708b1a6bc659e5671463dc493fcf0a9f482.zip
Merge branch 'maint-0.2.9'
-rw-r--r--changes/bug207163
-rw-r--r--src/or/connection.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/changes/bug20716 b/changes/bug20716
new file mode 100644
index 0000000000..37fd6feecf
--- /dev/null
+++ b/changes/bug20716
@@ -0,0 +1,3 @@
+ o Minor bugfixes (client, memory leak):
+ - Fix a small memory leak when receiving AF_UNIX connections on
+ a SocksPort. Fixes bug 20716; bugfix on 0.2.6.3-alpha.
diff --git a/src/or/connection.c b/src/or/connection.c
index 2e3df34a5a..bdf14bb2fc 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1595,16 +1595,19 @@ connection_handle_listener_read(connection_t *conn, int new_type)
/* remember the remote address */
tor_addr_copy(&newconn->addr, &addr);
- newconn->port = port;
- newconn->address = tor_addr_to_str_dup(&addr);
+ if (new_type == CONN_TYPE_AP && conn->socket_family == AF_UNIX) {
+ newconn->port = 0;
+ newconn->address = tor_strdup(conn->address);
+ } else {
+ newconn->port = port;
+ newconn->address = tor_addr_to_str_dup(&addr);
+ }
if (new_type == CONN_TYPE_AP && conn->socket_family != AF_UNIX) {
log_info(LD_NET, "New SOCKS connection opened from %s.",
fmt_and_decorate_addr(&addr));
}
if (new_type == CONN_TYPE_AP && conn->socket_family == AF_UNIX) {
- newconn->port = 0;
- newconn->address = tor_strdup(conn->address);
log_info(LD_NET, "New SOCKS AF_UNIX connection opened");
}
if (new_type == CONN_TYPE_CONTROL) {