X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Fs2_enc.c;h=1f62acd5b1e6fb1199c350ffe2452e8c51689a7b;hp=18882bf70487f56bf73abff5b6b3a36ccaf849b4;hb=cc684e330b61975a4c478e01a46ca687106eebbf;hpb=85c6749216f47bcefc916d4b0331794dac0a5db7;ds=sidebyside diff --git a/ssl/s2_enc.c b/ssl/s2_enc.c index 18882bf704..1f62acd5b1 100644 --- a/ssl/s2_enc.c +++ b/ssl/s2_enc.c @@ -82,15 +82,18 @@ int ssl2_enc_init(SSL *s, int client) ((s->enc_read_ctx=(EVP_CIPHER_CTX *) OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)) goto err; + + /* make sure it's intialized in case the malloc for enc_write_ctx fails + * and we exit with an error */ + rs= s->enc_read_ctx; + EVP_CIPHER_CTX_init(rs); + if ((s->enc_write_ctx == NULL) && ((s->enc_write_ctx=(EVP_CIPHER_CTX *) OPENSSL_malloc(sizeof(EVP_CIPHER_CTX))) == NULL)) goto err; - rs= s->enc_read_ctx; ws= s->enc_write_ctx; - - EVP_CIPHER_CTX_init(rs); EVP_CIPHER_CTX_init(ws); num=c->key_len;