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


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

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

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

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

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

crypto/mem.c:295:1: parameter `str` of CRYPTO_free
      293.   }
      294.   
      295. > void CRYPTO_free(void *str, const char *file, int line)
      296.   {
      297.       INCREMENT(free_count);

crypto/mem.c:312:5: was invalidated by call to `free()`
      310.       }
      311.   #else
      312.       free(str);
                 ^
      313.   #endif
      314.   }

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

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

crypto/evp/evp_enc.c:56:12: when calling `EVP_CipherInit_ex` here
  54.       if (cipher != NULL)
  55.           EVP_CIPHER_CTX_reset(ctx);
  56.       return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, enc);
                   ^
  57.   }
  58.   

crypto/mem.c:295:1: parameter `str` of CRYPTO_free
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:312:5: invalid access occurs here
    310.       }
    311.   #else
    312.       free(str);
               ^
    313.   #endif
    314.   }
