apps/s_client.c: add missing null check

apps/s_server.c: remove unnecessary null check

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4558)
This commit is contained in:
KaoruToda 2017-10-19 23:41:03 +09:00 committed by Andy Polyakov
parent 0c1aaa24cc
commit f84a648ca1
2 changed files with 20 additions and 14 deletions

View File

@ -1866,6 +1866,9 @@ int s_client_main(int argc, char **argv)
goto end;
con = SSL_new(ctx);
if (con == NULL)
goto end;
if (sess_in != NULL) {
SSL_SESSION *sess;
BIO *stmp = BIO_new_file(sess_in, "r");

View File

@ -2202,22 +2202,25 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
BIO_printf(bio_err, "Turned on non blocking io\n");
}
con = SSL_new(ctx);
if (con == NULL) {
con = SSL_new(ctx);
if (s_tlsextdebug) {
SSL_set_tlsext_debug_callback(con, tlsext_cb);
SSL_set_tlsext_debug_arg(con, bio_s_out);
}
if (context
&& !SSL_set_session_id_context(con,
context, strlen((char *)context))) {
BIO_printf(bio_err, "Error setting session id context\n");
ret = -1;
goto err;
}
ret = -1;
goto err;
}
if (s_tlsextdebug) {
SSL_set_tlsext_debug_callback(con, tlsext_cb);
SSL_set_tlsext_debug_arg(con, bio_s_out);
}
if (context != NULL
&& !SSL_set_session_id_context(con, context,
strlen((char *)context))) {
BIO_printf(bio_err, "Error setting session id context\n");
ret = -1;
goto err;
}
if (!SSL_clear(con)) {
BIO_printf(bio_err, "Error clearing SSL connection\n");
ret = -1;