# HG changeset patch # User Igor Sysoev # Date 1164211214 0 # Node ID 6044cea025fa4fa1d2d2fbd63773c6b78219936e # Parent 4924b71d77f6e1f4edccca3a827989ddae779bba fix segfault when connect() failed diff --git a/src/imap/ngx_imap_auth_http_module.c b/src/imap/ngx_imap_auth_http_module.c --- a/src/imap/ngx_imap_auth_http_module.c +++ b/src/imap/ngx_imap_auth_http_module.c @@ -182,7 +182,10 @@ ngx_imap_auth_http_init(ngx_imap_session rc = ngx_event_connect_peer(&ctx->peer); if (rc == NGX_ERROR || rc == NGX_BUSY || rc == NGX_DECLINED) { - ngx_close_connection(ctx->peer.connection); + if (ctx->peer.connection) { + ngx_close_connection(ctx->peer.connection); + } + ngx_destroy_pool(ctx->pool); ngx_imap_session_internal_server_error(s); return;