Commit 01574d4061a6dbaef0f8a887010cba3e9b62b87d

Patrick Steinhardt 2018-06-29T11:28:17

Merge pull request #4701 from nikital/master streams: openssl: Handle error in SSL_CTX_new

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index 103e45f..8a1befc 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -219,6 +219,10 @@ int git_openssl_stream_global_init(void)
 	 * to speak TLSv1 to perform the encryption itself.
 	 */
 	git__ssl_ctx = SSL_CTX_new(SSLv23_method());
+	if (!git__ssl_ctx) {
+		return -1;
+	}
+
 	SSL_CTX_set_options(git__ssl_ctx, ssl_opts);
 	SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
 	SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);