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


crypto/evp/digest.c:163:1: invalidation part of the trace starts here
161.   }
162.   
163. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
164.   {
165.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:163:1: parameter `ctx` of EVP_DigestInit
  161.   }
  162.   
  163. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  164.   {
  165.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:165:5: when calling `EVP_MD_CTX_reset` here
  163.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  164.   {
  165.       EVP_MD_CTX_reset(ctx);
             ^
  166.       return EVP_DigestInit_ex(ctx, type, NULL);
  167.   }

crypto/evp/digest.c:122:1: parameter `ctx` of EVP_MD_CTX_reset
    120.   
    121.   /* This call frees resources associated with the context */
    122. > int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
    123.   {
    124.       if (ctx == NULL)

crypto/evp/digest.c:138:5: when calling `EVP_PKEY_CTX_free` here
    136.           OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);
    137.       }
    138.       EVP_PKEY_CTX_free(ctx->pctx);
               ^
    139.   #ifndef OPENSSL_NO_ENGINE
    140.       if (ctx->engine)

crypto/evp/pmeth_lib.c:323:1: parameter `ctx` of EVP_PKEY_CTX_free
      321.   }
      322.   
      323. > void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
      324.   {
      325.       if (ctx == NULL)

crypto/evp/pmeth_lib.c:339:5: when calling `CRYPTO_free` here
      337.           ENGINE_finish(ctx->engine);
      338.   #endif
      339.       OPENSSL_free(ctx);
                 ^
      340.   }
      341.   

crypto/mem.c:225:1: parameter `str` of CRYPTO_free
        223.   }
        224.   
        225. > void CRYPTO_free(void *str, const char *file, int line)
        226.   {
        227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:241:5: was invalidated by call to `free()`
        239.       }
        240.   #else
        241.       free(str);
                   ^
        242.   #endif
        243.   }

crypto/evp/digest.c:163:1: use-after-lifetime part of the trace starts here
161.   }
162.   
163. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
164.   {
165.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:163:1: parameter `ctx` of EVP_DigestInit
  161.   }
  162.   
  163. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  164.   {
  165.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:166:12: when calling `EVP_DigestInit_ex` here
  164.   {
  165.       EVP_MD_CTX_reset(ctx);
  166.       return EVP_DigestInit_ex(ctx, type, NULL);
                    ^
  167.   }
  168.   

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

crypto/evp/digest.c:244:13: when calling `EVP_PKEY_CTX_ctrl` here
    242.       if (ctx->pctx) {
    243.           int r;
    244.           r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
                       ^
    245.                                 EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
    246.           if (r <= 0 && (r != -2))

crypto/evp/pmeth_lib.c:342:1: parameter `ctx` of EVP_PKEY_CTX_ctrl
      340.   }
      341.   
      342. > int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
      343.                         int cmd, int p1, void *p2)
      344.   {

crypto/evp/pmeth_lib.c:363:11: invalid access occurs here
      361.       }
      362.   
      363.       ret = ctx->pmeth->ctrl(ctx, cmd, p1, p2);
                       ^
      364.   
      365.       if (ret == -2)
