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


crypto/evp/digest.c:375:1: invalidation part of the trace starts here
373.   }
374.   
375. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
376.   {
377.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:375:1: parameter `out` of EVP_MD_CTX_copy
  373.   }
  374.   
  375. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  376.   {
  377.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:377:5: when calling `EVP_MD_CTX_reset` here
  375.   int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  376.   {
  377.       EVP_MD_CTX_reset(out);
             ^
  378.       return EVP_MD_CTX_copy_ex(out, in);
  379.   }

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

crypto/evp/digest.c:52:9: when calling `CRYPTO_clear_free` here
    50.       if (ctx->digest && ctx->digest->ctx_size && ctx->md_data
    51.           && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) {
    52.           OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
                  ^
    53.       }
    54.       /*

crypto/mem.c:316:1: parameter `str` of CRYPTO_clear_free
      314.   }
      315.   
      316. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
      317.   {
      318.       if (str == NULL)

crypto/mem.c:322:5: when calling `CRYPTO_free` here
      320.       if (num)
      321.           OPENSSL_cleanse(str, num);
      322.       CRYPTO_free(str, file, line);
                 ^
      323.   }

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:375:1: use-after-lifetime part of the trace starts here
373.   }
374.   
375. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
376.   {
377.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:375:1: parameter `out` of EVP_MD_CTX_copy
  373.   }
  374.   
  375. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  376.   {
  377.       EVP_MD_CTX_reset(out);

crypto/evp/digest.c:378:12: when calling `EVP_MD_CTX_copy_ex` here
  376.   {
  377.       EVP_MD_CTX_reset(out);
  378.       return EVP_MD_CTX_copy_ex(out, in);
                    ^
  379.   }
  380.   

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