crypto/evp/digest.c:206: error: USE_AFTER_FREE
  call to `EVP_MD_CTX_copy_ex()` eventually accesses memory that was invalidated by call to `free()` on line 205 indirectly during the call to `EVP_MD_CTX_reset()`.
Showing all 16 steps of the trace


crypto/evp/digest.c:203:1: invalidation part of the trace starts here
201.   }
202.   
203. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
204.   {
205.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:203:1: parameter `out` of EVP_MD_CTX_copy
  201.   }
  202.   
  203. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  204.   {
  205.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:205:5: when calling `EVP_MD_CTX_reset` here
  203.   int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  204.   {
  205.       EVP_MD_CTX_reset(out);
             ^
  206.       return EVP_MD_CTX_copy_ex(out, in);
  207.   }

crypto/evp/digest.c:19:1: parameter `ctx` of EVP_MD_CTX_reset
    17.   
    18.   /* This call frees resources associated with the context */
    19. > int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
    20.   {
    21.       if (ctx == NULL)

crypto/evp/digest.c:40:9: when calling `EVP_PKEY_CTX_free` here
    38.        */
    39.       if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))
    40.           EVP_PKEY_CTX_free(ctx->pctx);
                  ^
    41.   #ifndef OPENSSL_NO_ENGINE
    42.       ENGINE_finish(ctx->engine);

crypto/evp/pmeth_lib.c:352:1: parameter `ctx` of EVP_PKEY_CTX_free
      350.   }
      351.   
      352. > void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
      353.   {
      354.       if (ctx == NULL)

crypto/evp/pmeth_lib.c:359:5: when calling `EVP_PKEY_free` here
      357.           ctx->pmeth->cleanup(ctx);
      358.       EVP_PKEY_free(ctx->pkey);
      359.       EVP_PKEY_free(ctx->peerkey);
                 ^
      360.   #ifndef OPENSSL_NO_ENGINE
      361.       ENGINE_finish(ctx->engine);

crypto/evp/p_lib.c:590:1: parameter `x` of EVP_PKEY_free
        588.   }
        589.   
        590. > void EVP_PKEY_free(EVP_PKEY *x)
        591.   {
        592.       int i;

crypto/evp/p_lib.c:605:5: when calling `CRYPTO_free` here
        603.       CRYPTO_THREAD_lock_free(x->lock);
        604.       sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
        605.       OPENSSL_free(x);
                   ^
        606.   }
        607.   

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/digest.c:203:1: use-after-lifetime part of the trace starts here
201.   }
202.   
203. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
204.   {
205.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:203:1: parameter `out` of EVP_MD_CTX_copy
  201.   }
  202.   
  203. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  204.   {
  205.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:206:12: when calling `EVP_MD_CTX_copy_ex` here
  204.   {
  205.       EVP_MD_CTX_reset(out);
  206.       return EVP_MD_CTX_copy_ex(out, in);
                    ^
  207.   }
  208.   

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.   }
