nghttpx: Fix heap-use-after-free

This commit is contained in:
Tatsuhiro Tsujikawa 2015-08-12 21:14:18 +09:00
parent b384b76f66
commit f8c30d0229
1 changed files with 8 additions and 6 deletions

View File

@ -77,12 +77,6 @@ Connection::~Connection() {
} }
void Connection::disconnect() { void Connection::disconnect() {
ev_timer_stop(loop, &rt);
ev_timer_stop(loop, &wt);
rlimit.stopw();
wlimit.stopw();
if (tls.ssl) { if (tls.ssl) {
SSL_set_shutdown(tls.ssl, SSL_RECEIVED_SHUTDOWN); SSL_set_shutdown(tls.ssl, SSL_RECEIVED_SHUTDOWN);
ERR_clear_error(); ERR_clear_error();
@ -110,6 +104,14 @@ void Connection::disconnect() {
close(fd); close(fd);
fd = -1; fd = -1;
} }
// Stop watchers here because they could be activated in
// SSL_shutdown().
ev_timer_stop(loop, &rt);
ev_timer_stop(loop, &wt);
rlimit.stopw();
wlimit.stopw();
} }
namespace { namespace {