summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/connection.c3
-rw-r--r--src/or/geoip.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 4c6826269d..8c4228e5cc 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -992,6 +992,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
@@ -1000,9 +1001,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;
}
}
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 6b7cc82b82..8ca95af2e6 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -1316,8 +1316,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);
}