summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection.c4
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/geoip.c5
3 files changed, 10 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 0d8242a54e..d0602fde24 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1058,6 +1058,7 @@ connection_listener_new(const struct sockaddr *listensockaddr,
if (bind(s, listensockaddr, (socklen_t)sizeof(struct sockaddr_un)) == -1) {
log_warn(LD_NET,"Bind to %s failed: %s.", address,
tor_socket_strerror(tor_socket_errno(s)));
+ tor_close_socket(s);
goto err;
}
#ifdef HAVE_PWD_H
@@ -1066,9 +1067,11 @@ connection_listener_new(const struct sockaddr *listensockaddr,
if (pw == NULL) {
log_warn(LD_NET,"Unable to chown() %s socket: user %s not found.",
address, options->User);
+ tor_close_socket(s);
} else if (chown(address, pw->pw_uid, pw->pw_gid) < 0) {
log_warn(LD_NET,"Unable to chown() %s socket: %s.",
address, strerror(errno));
+ tor_close_socket(s);
goto err;
}
}
@@ -1707,6 +1710,7 @@ connection_read_https_proxy_response(connection_t *conn)
tor_free(headers);
return -1;
}
+ tor_free(headers);
if (!reason) reason = tor_strdup("[no reason given]");
if (status_code == 200) {
diff --git a/src/or/control.c b/src/or/control.c
index 9ab0dafb7b..03e5d79c8e 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -3143,6 +3143,8 @@ handle_control_authchallenge(control_connection_t *conn, uint32_t len,
"SERVERNONCE=%s\r\n",
server_hash_encoded,
server_nonce_encoded);
+
+ tor_free(client_nonce);
return 0;
}
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 9ba1e31b8b..e2e98e8ec4 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -1350,8 +1350,11 @@ load_bridge_stats(time_t now)
fname = get_datadir_fname2("stats", "bridge-stats");
contents = read_file_to_str(fname, RFTS_IGNORE_MISSING, NULL);
- if (contents && validate_bridge_stats(contents, now))
+ if (contents && validate_bridge_stats(contents, now)) {
bridge_stats_extrainfo = contents;
+ } else {
+ tor_free(contents);
+ }
tor_free(fname);
}