crypto/x509/x509_cmp.c:268: error: USE_AFTER_FREE
  call to `EVP_MD_CTX_free()` eventually accesses memory that was invalidated by call to `free()` on line 262 indirectly during the call to `EVP_DigestInit_ex()`.
Showing all 16 steps of the trace


crypto/x509/x509_cmp.c:252:26: invalidation part of the trace starts here
250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
251.   {
252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                ^
253.       unsigned long ret = 0;
254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:26: passed as argument to `EVP_MD_CTX_new`
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                  ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:26: return from call to `EVP_MD_CTX_new`
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                  ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:5: assigned
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
             ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:262:9: when calling `EVP_DigestInit_ex` here
  260.       i2d_X509_NAME(x, NULL);
  261.       EVP_MD_CTX_set_flags(md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW);
  262.       if (EVP_DigestInit_ex(md_ctx, EVP_md5(), NULL)
                 ^
  263.           && EVP_DigestUpdate(md_ctx, x->bytes->data, x->bytes->length)
  264.           && EVP_DigestFinal_ex(md_ctx, md, NULL))

crypto/evp/digest.c:170:1: parameter `ctx` of EVP_DigestInit_ex
    168.   }
    169.   
    170. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
    171.   {
    172.       EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);

crypto/evp/digest.c:229:13: when calling `CRYPTO_free` here
    227.       if (ctx->digest != type) {
    228.           if (ctx->digest && ctx->digest->ctx_size)
    229.               OPENSSL_free(ctx->md_data);
                       ^
    230.           ctx->digest = type;
    231.           if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {

crypto/mem.c:234:1: parameter `str` of CRYPTO_free
      232.   }
      233.   
      234. > void CRYPTO_free(void *str)
      235.   {
      236.   #ifdef CRYPTO_MDEBUG

crypto/mem.c:245:5: was invalidated by call to `free()`
      243.       }
      244.   #else
      245.       free(str);
                 ^
      246.   #endif
      247.   }

crypto/x509/x509_cmp.c:252:26: use-after-lifetime part of the trace starts here
250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
251.   {
252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                ^
253.       unsigned long ret = 0;
254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:26: passed as argument to `EVP_MD_CTX_new`
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                  ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:26: return from call to `EVP_MD_CTX_new`
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
                                  ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:252:5: assigned
  250.   unsigned long X509_NAME_hash_old(X509_NAME *x)
  251.   {
  252.       EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
             ^
  253.       unsigned long ret = 0;
  254.       unsigned char md[16];

crypto/x509/x509_cmp.c:268:5: when calling `EVP_MD_CTX_free` here
  266.                  ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
  267.               ) & 0xffffffffL;
  268.       EVP_MD_CTX_free(md_ctx);
             ^
  269.   
  270.       return (ret);

crypto/mem.c:234:1: parameter `str` of CRYPTO_free
    232.   }
    233.   
    234. > void CRYPTO_free(void *str)
    235.   {
    236.   #ifdef CRYPTO_MDEBUG

crypto/mem.c:245:5: invalid access occurs here
    243.       }
    244.   #else
    245.       free(str);
               ^
    246.   #endif
    247.   }
