diff options
author | Nils Larsch <nils@openssl.org> | 2007-02-16 20:40:07 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2007-02-16 20:40:07 +0000 |
commit | d31a13953c633f48a5e30e89fc66604b68d79c34 (patch) | |
tree | 0ae107ea1eefba1941dabab454c5b7a5ff690833 /ssl/s2_enc.c | |
parent | 28f5873179b52f50b8d2be201c77592cd3a43e2e (diff) |
ensure that the EVP_CIPHER_CTX object is initialized
PR: 1490
Diffstat (limited to 'ssl/s2_enc.c')
-rw-r--r-- | ssl/s2_enc.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |