From 0de2e655cfae053725660e03e8ff49e427a566a0 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Wed, 22 Nov 2006 16:00:14 +0000 Subject: [PATCH] fix segfault when connect() failed --- src/imap/ngx_imap_auth_http_module.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/imap/ngx_imap_auth_http_module.c b/src/imap/ngx_imap_auth_http_module.c index beca1950d..d39c29502 100644 --- 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_t *s) 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;