imap-send: check NULL return of SSL_CTX_new()

SSL_CTX_new() may fail with return value NULL.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Kazuki Yamaguchi 2016-04-09 01:22:14 +09:00 committed by Junio C Hamano
parent 1ed2c7b115
commit 6738a33b31
1 changed files with 4 additions and 0 deletions

View File

@ -298,6 +298,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
}

ctx = SSL_CTX_new(meth);
if (!ctx) {
ssl_socket_perror("SSL_CTX_new");
return -1;
}

if (verify)
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);