mirror of
https://github.com/nginx/nginx.git
synced 2026-10-26 07:20:04 -05:00
Mail: fix session cleanup on error path
Previously, when ngx_handle_read_event() or ngx_handle_write_event() returned an error while handling an SMTP, POP3 or IMAP session, the released session memory could be accessed after handling the error.
This commit is contained in:
1 parent
58a7bc3406
commit
a4d5da3e40
4 files changed
+4
No files matched your search
@@ -48,6 +48,7 @@ ngx_mail_imap_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_mail_send(c->write);
|
||||
|
||||
@@ -69,6 +69,7 @@ ngx_mail_pop3_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_mail_send(c->write);
|
||||
|
||||
@@ -894,6 +894,7 @@ ngx_mail_proxy_write_handler(ngx_event_t *wev)
|
||||
|
||||
if (ngx_handle_write_event(wev, 0) != NGX_OK) {
|
||||
ngx_mail_proxy_internal_server_error(s);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->read->ready) {
|
||||
|
||||
@@ -340,6 +340,7 @@ ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
||||
ngx_mail_close_connection(c);
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->read->ready) {
|
||||
|
||||
Reference in new issue
Block a user