提交 67afcfd3 编写于 作者: M Matt Caswell 提交者: Paul Yang

Free SSL object on an error path

Thanks to @fangang190 for reporting this

Fixes #7061
Reviewed-by: NPaul Yang <yang.yang@baishancloud.com>
(Merged from https://github.com/openssl/openssl/pull/7065)
上级 c2cb1a18
...@@ -2968,8 +2968,10 @@ static int www_body(int s, int stype, int prot, unsigned char *context) ...@@ -2968,8 +2968,10 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
if (context != NULL if (context != NULL
&& !SSL_set_session_id_context(con, context, && !SSL_set_session_id_context(con, context,
strlen((char *)context))) strlen((char *)context))) {
SSL_free(con);
goto err; goto err;
}
sbio = BIO_new_socket(s, BIO_NOCLOSE); sbio = BIO_new_socket(s, BIO_NOCLOSE);
if (s_nbio_test) { if (s_nbio_test) {
...@@ -2981,7 +2983,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context) ...@@ -2981,7 +2983,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
SSL_set_bio(con, sbio, sbio); SSL_set_bio(con, sbio, sbio);
SSL_set_accept_state(con); SSL_set_accept_state(con);
/* SSL_set_fd(con,s); */ /* No need to free |con| after this. Done by BIO_free(ssl_bio) */
BIO_set_ssl(ssl_bio, con, BIO_CLOSE); BIO_set_ssl(ssl_bio, con, BIO_CLOSE);
BIO_push(io, ssl_bio); BIO_push(io, ssl_bio);
#ifdef CHARSET_EBCDIC #ifdef CHARSET_EBCDIC
...@@ -3337,6 +3339,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context) ...@@ -3337,6 +3339,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
if (context != NULL if (context != NULL
&& !SSL_set_session_id_context(con, context, && !SSL_set_session_id_context(con, context,
strlen((char *)context))) { strlen((char *)context))) {
SSL_free(con);
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
goto err; goto err;
} }
...@@ -3345,6 +3348,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context) ...@@ -3345,6 +3348,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
SSL_set_bio(con, sbio, sbio); SSL_set_bio(con, sbio, sbio);
SSL_set_accept_state(con); SSL_set_accept_state(con);
/* No need to free |con| after this. Done by BIO_free(ssl_bio) */
BIO_set_ssl(ssl_bio, con, BIO_CLOSE); BIO_set_ssl(ssl_bio, con, BIO_CLOSE);
BIO_push(io, ssl_bio); BIO_push(io, ssl_bio);
#ifdef CHARSET_EBCDIC #ifdef CHARSET_EBCDIC
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册