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


crypto/evp/digest.c:158:1: invalidation part of the trace starts here
156.   }
157.   
158. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
159.   {
160.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:158:1: parameter `ctx` of EVP_DigestInit
  156.   }
  157.   
  158. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  159.   {
  160.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:160:5: when calling `EVP_MD_CTX_reset` here
  158.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  159.   {
  160.       EVP_MD_CTX_reset(ctx);
             ^
  161.       return EVP_DigestInit_ex(ctx, type, NULL);
  162.   }

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.       ENGINE_finish(ctx->engine);

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

crypto/evp/pmeth_lib.c:333:5: when calling `CRYPTO_free` here
      331.       ENGINE_finish(ctx->engine);
      332.   #endif
      333.       OPENSSL_free(ctx);
                 ^
      334.   }
      335.   

crypto/mem.c:210:1: parameter `str` of CRYPTO_free
        208.   }
        209.   
        210. > void CRYPTO_free(void *str, const char *file, int line)
        211.   {
        212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:226:5: was invalidated by call to `free()`
        224.       }
        225.   #else
        226.       free(str);
                   ^
        227.   #endif
        228.   }

crypto/evp/digest.c:158:1: use-after-lifetime part of the trace starts here
156.   }
157.   
158. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
159.   {
160.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:158:1: parameter `ctx` of EVP_DigestInit
  156.   }
  157.   
  158. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
  159.   {
  160.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:161:12: when calling `EVP_DigestInit_ex` here
  159.   {
  160.       EVP_MD_CTX_reset(ctx);
  161.       return EVP_DigestInit_ex(ctx, type, NULL);
                    ^
  162.   }
  163.   

crypto/evp/digest.c:164:1: parameter `ctx` of EVP_DigestInit_ex
    162.   }
    163.   
    164. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
    165.   {
    166.       EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);

crypto/evp/digest.c:239:13: when calling `EVP_PKEY_CTX_ctrl` here
    237.       if (ctx->pctx) {
    238.           int r;
    239.           r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
                       ^
    240.                                 EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);
    241.           if (r <= 0 && (r != -2))

crypto/evp/pmeth_lib.c:336:1: parameter `ctx` of EVP_PKEY_CTX_ctrl
      334.   }
      335.   
      336. > int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
      337.                         int cmd, int p1, void *p2)
      338.   {

crypto/evp/pmeth_lib.c:357:11: invalid access occurs here
      355.       }
      356.   
      357.       ret = ctx->pmeth->ctrl(ctx, cmd, p1, p2);
                       ^
      358.   
      359.       if (ret == -2)
