Fix memory leak.

This commit is contained in:
Ben Laurie 2001-08-05 16:13:49 +00:00
parent 0713f8abe6
commit db75357110

View file

@ -78,8 +78,8 @@ int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
if(enc && (enc != -1)) enc = 1;
if (cipher)
{
if(ctx->cipher_data)
OPENSSL_free(ctx->cipher_data);
if(ctx->cipher)
EVP_CIPHER_CTX_cleanup(ctx);
ctx->cipher=cipher;
ctx->cipher_data=OPENSSL_malloc(ctx->cipher->ctx_size);
ctx->key_len = cipher->key_len;