diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-01-14 19:00:23 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-01-14 19:00:23 +0000 |
commit | 3b8f76aa512338ec91104240d28d8f32246b5eb6 (patch) | |
tree | a0cfda3a8a0007ecea1bfaa242e7f5d1eda378e3 /src/or/dnsserv.c | |
parent | e49229caf8645564646354c6f3670db2cab26583 (diff) | |
download | tor-3b8f76aa512338ec91104240d28d8f32246b5eb6.tar.gz tor-3b8f76aa512338ec91104240d28d8f32246b5eb6.zip |
r17611@catbus: nickm | 2008-01-14 13:44:16 -0500
add some missing checks for failing return values.
svn:r13130
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r-- | src/or/dnsserv.c | 14 |
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), |