crypto/evp/evp_enc.c:54: error: USE_AFTER_FREE
  call to `EVP_CipherInit_ex()` eventually accesses memory that was invalidated by call to `free()` on line 53 indirectly during the call to `EVP_CIPHER_CTX_reset()`.
Showing all 12 steps of the trace


crypto/evp/evp_enc.c:50:1: invalidation part of the trace starts here
48.   }
49.   
50. > int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
51.                      const unsigned char *key, const unsigned char *iv, int enc)
52.   {

crypto/evp/evp_enc.c:50:1: parameter `ctx` of EVP_CipherInit
  48.   }
  49.   
  50. > int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
  51.                      const unsigned char *key, const unsigned char *iv, int enc)
  52.   {

crypto/evp/evp_enc.c:53:5: when calling `EVP_CIPHER_CTX_reset` here
  51.                      const unsigned char *key, const unsigned char *iv, int enc)
  52.   {
  53.       EVP_CIPHER_CTX_reset(ctx);
            ^
  54.       return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
  55.   }

crypto/evp/evp_enc.c:20:1: parameter `c` of EVP_CIPHER_CTX_reset
    18.   #include "evp_locl.h"
    19.   
    20. > int EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *c)
    21.   {
    22.       if (c == NULL)

crypto/evp/evp_enc.c:31:5: when calling `CRYPTO_free` here
    29.               OPENSSL_cleanse(c->cipher_data, c->cipher->ctx_size);
    30.       }
    31.       OPENSSL_free(c->cipher_data);
              ^
    32.   #ifndef OPENSSL_NO_ENGINE
    33.       ENGINE_finish(c->engine);

crypto/mem.c:163:1: parameter `str` of CRYPTO_free
      161.   }
      162.   
      163. > void CRYPTO_free(void *str, const char *file, int line)
      164.   {
      165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:179:5: was invalidated by call to `free()`
      177.       }
      178.   #else
      179.       free(str);
                 ^
      180.   #endif
      181.   }

crypto/evp/evp_enc.c:50:1: use-after-lifetime part of the trace starts here
48.   }
49.   
50. > int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
51.                      const unsigned char *key, const unsigned char *iv, int enc)
52.   {

crypto/evp/evp_enc.c:50:1: parameter `ctx` of EVP_CipherInit
  48.   }
  49.   
  50. > int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
  51.                      const unsigned char *key, const unsigned char *iv, int enc)
  52.   {

crypto/evp/evp_enc.c:54:12: when calling `EVP_CipherInit_ex` here
  52.   {
  53.       EVP_CIPHER_CTX_reset(ctx);
  54.       return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
                   ^
  55.   }
  56.   

crypto/mem.c:163:1: parameter `str` of CRYPTO_free
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:179:5: invalid access occurs here
    177.       }
    178.   #else
    179.       free(str);
               ^
    180.   #endif
    181.   }
