aboutsummaryrefslogtreecommitdiff
path: root/src/or/dnsserv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r--src/or/dnsserv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 25a545ecc1..2cc343dc30 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -130,7 +130,12 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
conn->dns_server_request = req;
- connection_add(TO_CONN(conn));
+ if (connection_add(TO_CONN(conn)) < 0) {
+ log_warn(LD_APP, "Couldn't register dummy connection for DNS request");
+ evdns_server_request_respond(req, DNS_ERR_SERVERFAILED);
+ connection_free(TO_CONN(conn));
+ return;
+ }
control_event_stream_status(conn, STREAM_EVENT_NEW, 0);
@@ -171,7 +176,12 @@ dnsserv_launch_request(const char *name, int reverse)
strlcpy(conn->socks_request->address, name,
sizeof(conn->socks_request->address));
- connection_add(TO_CONN(conn));
+ if (connection_add(TO_CONN(conn))<0) {
+ log_warn(LD_APP, "Couldn't register dummy connection for RESOLVE request");
+ evdns_server_request_respond(req, DNS_ERR_SERVERFAILED);
+ connection_free(TO_CONN(conn));
+ return;
+ }
/* Now, throw the connection over to get rewritten (which will answer it
* immediately if it's in the cache, or completely bogus, or automapped),