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


crypto/evp/digest.c:97:1: invalidation part of the trace starts here
95.   }
96.   
97. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
98.   {
99.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:97:1: parameter `ctx` of EVP_DigestInit
  95.   }
  96.   
  97. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  98.   {
  99.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:99:5: when calling `EVP_MD_CTX_reset` here
  97.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  98.   {
  99.       EVP_MD_CTX_reset(ctx);
             ^
  100.       return EVP_DigestInit_ex(ctx, type, NULL);
  101.   }

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:59:9: when calling `EVP_PKEY_CTX_free` here
    57.        */
    58.       if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))
    59.           EVP_PKEY_CTX_free(ctx->pctx);
                  ^
    60.   #ifndef OPENSSL_NO_ENGINE
    61.       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:363:5: when calling `CRYPTO_free` here
      361.       ENGINE_finish(ctx->engine);
      362.   #endif
      363.       OPENSSL_free(ctx);
                 ^
      364.   }
      365.   

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:97:1: use-after-lifetime part of the trace starts here
95.   }
96.   
97. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
98.   {
99.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:97:1: parameter `ctx` of EVP_DigestInit
  95.   }
  96.   
  97. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  98.   {
  99.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:100:12: when calling `EVP_DigestInit_ex` here
  98.   {
  99.       EVP_MD_CTX_reset(ctx);
  100.       return EVP_DigestInit_ex(ctx, type, NULL);
                    ^
  101.   }
  102.   

crypto/evp/digest.c:103:1: parameter `ctx` of EVP_DigestInit_ex
    101.   }
    102.   
    103. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
    104.   {
    105.       EVP_MD *provmd;

crypto/evp/digest.c:254:13: when calling `EVP_PKEY_CTX_ctrl` here
    252.       if (ctx->pctx) {
    253.           int r;
    254.           r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
                       ^
    255.                                 EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
    256.           if (r <= 0 && (r != -2))

crypto/evp/pmeth_lib.c:366:1: parameter `ctx` of EVP_PKEY_CTX_ctrl
      364.   }
      365.   
      366. > int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
      367.                         int cmd, int p1, void *p2)
      368.   {

crypto/evp/pmeth_lib.c:393:11: invalid access occurs here
      391.   
      392.    doit:
      393.       ret = ctx->pmeth->ctrl(ctx, cmd, p1, p2);
                       ^
      394.   
      395.       if (ret == -2)
