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


crypto/evp/digest.c:55:1: invalidation part of the trace starts here
53.   }
54.   
55. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
56.   {
57.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:55:1: parameter `ctx` of EVP_DigestInit
  53.   }
  54.   
  55. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  56.   {
  57.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:57:5: when calling `EVP_MD_CTX_reset` here
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  56.   {
  57.       EVP_MD_CTX_reset(ctx);
            ^
  58.       return EVP_DigestInit_ex(ctx, type, NULL);
  59.   }

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:35:5: when calling `EVP_PKEY_CTX_free` here
    33.           OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
    34.       }
    35.       EVP_PKEY_CTX_free(ctx->pctx);
              ^
    36.   #ifndef OPENSSL_NO_ENGINE
    37.       ENGINE_finish(ctx->engine);

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

crypto/evp/pmeth_lib.c:361:5: when calling `CRYPTO_free` here
      359.       ENGINE_finish(ctx->engine);
      360.   #endif
      361.       OPENSSL_free(ctx);
                 ^
      362.   }
      363.   

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:55:1: use-after-lifetime part of the trace starts here
53.   }
54.   
55. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
56.   {
57.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:55:1: parameter `ctx` of EVP_DigestInit
  53.   }
  54.   
  55. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  56.   {
  57.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:58:12: when calling `EVP_DigestInit_ex` here
  56.   {
  57.       EVP_MD_CTX_reset(ctx);
  58.       return EVP_DigestInit_ex(ctx, type, NULL);
                   ^
  59.   }
  60.   

crypto/evp/digest.c:61:1: parameter `ctx` of EVP_DigestInit_ex
    59.   }
    60.   
    61. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
    62.   {
    63.       EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);

crypto/evp/digest.c:136:13: when calling `EVP_PKEY_CTX_ctrl` here
    134.       if (ctx->pctx) {
    135.           int r;
    136.           r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
                       ^
    137.                                 EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
    138.           if (r <= 0 && (r != -2))

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

crypto/evp/pmeth_lib.c:385:11: invalid access occurs here
      383.       }
      384.   
      385.       ret = ctx->pmeth->ctrl(ctx, cmd, p1, p2);
                       ^
      386.   
      387.       if (ret == -2)
