Merge remote-tracking branch 'origin/patches-2.0'

This commit is contained in:
Nick Mathewson 2011-04-14 14:20:09 -04:00
commit d28fc52815
2 changed files with 7 additions and 5 deletions

View File

@ -4312,7 +4312,8 @@ evdns_getaddrinfo_gotresolve(int result, char type, int count,
evdns_cancel_request(NULL, other_req->r);
}
data->user_cb(EVUTIL_EAI_MEMORY, NULL, data->user_data);
evutil_freeaddrinfo(res);
if (res)
evutil_freeaddrinfo(res);
if (other_req->r == NULL)
free_getaddrinfo_request(data);

View File

@ -144,7 +144,7 @@ dump_request_cb(struct evhttp_request *req, void *arg)
static void
send_document_cb(struct evhttp_request *req, void *arg)
{
struct evbuffer *evb;
struct evbuffer *evb = NULL;
const char *docroot = arg;
const char *uri = evhttp_request_get_uri(req);
struct evhttp_uri *decoded = NULL;
@ -229,7 +229,6 @@ send_document_cb(struct evhttp_request *req, void *arg)
if (!(d = opendir(whole_path)))
goto err;
#endif
close(fd);
evbuffer_add_printf(evb, "<html>\n <head>\n"
" <title>%s</title>\n"
@ -286,18 +285,20 @@ send_document_cb(struct evhttp_request *req, void *arg)
}
evhttp_send_reply(req, 200, "OK", evb);
evbuffer_free(evb);
return;
goto done;
err:
evhttp_send_error(req, 404, "Document was not found");
if (fd>=0)
close(fd);
done:
if (decoded)
evhttp_uri_free(decoded);
if (decoded_path)
free(decoded_path);
if (whole_path)
free(whole_path);
if (evb)
evbuffer_free(evb);
}
static void