summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/cpuworker.c3
-rw-r--r--src/or/dns.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index b6e8ca6c9d..155a875fa6 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -262,7 +262,7 @@ static int cpuworker_main(void *data) {
}
if (write_all(fd, buf, LEN_ONION_RESPONSE, 1) != LEN_ONION_RESPONSE) {
log_fn(LOG_ERR,"writing response buf failed. Exiting.");
- spawn_exit();
+ goto end;
}
log_fn(LOG_DEBUG,"finished writing response.");
}
@@ -272,6 +272,7 @@ static int cpuworker_main(void *data) {
crypto_free_pk_env(onion_key);
if (last_onion_key)
crypto_free_pk_env(last_onion_key);
+ close(fd);
spawn_exit();
return 0; /* windows wants this function to return an int */
}
diff --git a/src/or/dns.c b/src/or/dns.c
index b595668f53..de4f4b800f 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -728,11 +728,13 @@ static int dnsworker_main(void *data) {
log_fn(LOG_INFO,"DNS worker exiting because of error on connection to Tor process.");
log_fn(LOG_INFO,"(Error on %d was %s)", fd, tor_socket_strerror(tor_socket_errno(fd)));
}
+ close(fd);
spawn_exit();
}
if (address_len && read_all(fd, address, address_len, 1) != address_len) {
log_fn(LOG_ERR,"read hostname failed. Child exiting.");
+ close(fd);
spawn_exit();
}
address[address_len] = 0; /* null terminate it */
@@ -759,6 +761,7 @@ static int dnsworker_main(void *data) {
set_uint32(answer+1, ip);
if (write_all(fd, answer, 5, 1) != 5) {
log_fn(LOG_ERR,"writing answer failed. Child exiting.");
+ close(fd);
spawn_exit();
}
}