Fix memory leak.
authorBen Laurie <ben@openssl.org>
Sun, 5 Aug 2001 16:13:49 +0000 (16:13 +0000)
committerBen Laurie <ben@openssl.org>
Sun, 5 Aug 2001 16:13:49 +0000 (16:13 +0000)
crypto/evp/evp_enc.c

index d67f0cda431901fa07d2e74abb79146159cc60e7..e3ed556f2610dabd1c82aa1daf109ecd737ebc46 100644 (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;