crypto/evp/p_verify.c:38: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 30, column 31 is not reachable after line 38, column 9.
Showing all 65 steps of the trace


crypto/evp/p_verify.c:17:1: start of procedure EVP_VerifyFinal()
15.   #include "internal/evp_int.h"
16.   
17. > int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
18.                       unsigned int siglen, EVP_PKEY *pkey)
19.   {

crypto/evp/p_verify.c:21:5: 
19.   {
20.       unsigned char m[EVP_MAX_MD_SIZE];
21. >     unsigned int m_len = 0;
22.       int i = 0;
23.       EVP_PKEY_CTX *pkctx = NULL;

crypto/evp/p_verify.c:22:5: 
20.       unsigned char m[EVP_MAX_MD_SIZE];
21.       unsigned int m_len = 0;
22. >     int i = 0;
23.       EVP_PKEY_CTX *pkctx = NULL;
24.   

crypto/evp/p_verify.c:23:5: 
21.       unsigned int m_len = 0;
22.       int i = 0;
23. >     EVP_PKEY_CTX *pkctx = NULL;
24.   
25.       if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {

crypto/evp/p_verify.c:25:9: 
23.       EVP_PKEY_CTX *pkctx = NULL;
24.   
25. >     if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
26.           if (!EVP_DigestFinal_ex(ctx, m, &m_len))
27.               goto err;

crypto/evp/evp_lib.c:479:1: start of procedure EVP_MD_CTX_test_flags()
  477.   }
  478.   
  479. > int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
  480.   {
  481.       return (ctx->flags & flags);

crypto/evp/evp_lib.c:481:5: 
  479.   int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
  480.   {
  481. >     return (ctx->flags & flags);
  482.   }
  483.   

crypto/evp/evp_lib.c:482:1: return from a call to EVP_MD_CTX_test_flags
  480.   {
  481.       return (ctx->flags & flags);
  482. > }
  483.   
  484.   void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags)

crypto/evp/p_verify.c:25:9: Taking false branch
23.       EVP_PKEY_CTX *pkctx = NULL;
24.   
25.       if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
              ^
26.           if (!EVP_DigestFinal_ex(ctx, m, &m_len))
27.               goto err;

crypto/evp/p_verify.c:29:9: 
27.               goto err;
28.       } else {
29. >         int rv = 0;
30.           EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
31.           if (tmp_ctx == NULL) {

crypto/evp/p_verify.c:30:9: 
28.       } else {
29.           int rv = 0;
30. >         EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
31.           if (tmp_ctx == NULL) {
32.               EVPerr(EVP_F_EVP_VERIFYFINAL, ERR_R_MALLOC_FAILURE);

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

crypto/mem.c:218:1: start of procedure CRYPTO_zalloc()
    216.   }
    217.   
    218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    219.   {
    220.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:220:5: 
    218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    219.   {
    220. >     void *ret = CRYPTO_malloc(num, file, line);
    221.   
    222.       FAILTEST();

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
      187.   #endif
      188.   
      189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      190.   {
      191.       void *ret = NULL;

crypto/mem.c:191:5: 
      189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      190.   {
      191. >     void *ret = NULL;
      192.   
      193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
      192.   
      193.       INCREMENT(malloc_count);
      194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      195.           return malloc_impl(num, file, line);
      196.   

crypto/mem.c:197:9: Taking false branch
      195.           return malloc_impl(num, file, line);
      196.   
      197.       if (num == 0)
                     ^
      198.           return NULL;
      199.   

crypto/mem.c:201:5: 
      199.   
      200.       FAILTEST();
      201. >     allow_customize = 0;
      202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
      209.       }
      210.   #else
      211. >     (void)(file); (void)(line);
      212.       ret = malloc(num);
      213.   #endif

crypto/mem.c:211:19: 
      209.       }
      210.   #else
      211. >     (void)(file); (void)(line);
      212.       ret = malloc(num);
      213.   #endif

crypto/mem.c:212:5: 
      210.   #else
      211.       (void)(file); (void)(line);
      212. >     ret = malloc(num);
      213.   #endif
      214.   

crypto/mem.c:215:5: 
      213.   #endif
      214.   
      215. >     return ret;
      216.   }
      217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
      214.   
      215.       return ret;
      216. > }
      217.   
      218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:223:9: Taking true branch
    221.   
    222.       FAILTEST();
    223.       if (ret != NULL)
                   ^
    224.           memset(ret, 0, num);
    225.       return ret;

crypto/mem.c:224:9: 
    222.       FAILTEST();
    223.       if (ret != NULL)
    224. >         memset(ret, 0, num);
    225.       return ret;
    226.   }

crypto/mem.c:225:5: 
    223.       if (ret != NULL)
    224.           memset(ret, 0, num);
    225. >     return ret;
    226.   }
    227.   

crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
    224.           memset(ret, 0, num);
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/evp/p_verify.c:31:13: Taking false branch
29.           int rv = 0;
30.           EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
31.           if (tmp_ctx == NULL) {
                  ^
32.               EVPerr(EVP_F_EVP_VERIFYFINAL, ERR_R_MALLOC_FAILURE);
33.               return 0;

crypto/evp/p_verify.c:35:9: 
33.               return 0;
34.           }
35. >         rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);
36.           if (rv)
37.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);

crypto/evp/digest.c:204:1: start of procedure EVP_MD_CTX_copy_ex()
  202.   }
  203.   
  204. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  205.   {
  206.       unsigned char *tmp_buf;

crypto/evp/digest.c:207:10: Taking false branch
  205.   {
  206.       unsigned char *tmp_buf;
  207.       if ((in == NULL) || (in->digest == NULL)) {
                  ^
  208.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  209.           return 0;

crypto/evp/digest.c:207:26: Taking false branch
  205.   {
  206.       unsigned char *tmp_buf;
  207.       if ((in == NULL) || (in->digest == NULL)) {
                                  ^
  208.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  209.           return 0;

crypto/evp/digest.c:213:9: Taking true branch
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
                 ^
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/evp/digest.c:213:24: 
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213. >     if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/engine/eng_init.c:77:1: start of procedure ENGINE_init()
    75.   
    76.   /* The API (locked) version of "init" */
    77. > int ENGINE_init(ENGINE *e)
    78.   {
    79.       int ret;

crypto/engine/eng_init.c:80:9: Taking false branch
    78.   {
    79.       int ret;
    80.       if (e == NULL) {
                  ^
    81.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);
    82.           return 0;

crypto/engine/eng_init.c:84:10: 
    82.           return 0;
    83.       }
    84. >     if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
      103.   }
      104.   
      105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      106.   {
      107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking true branch
      105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      106.   {
      107.       if (pthread_once(once, init) != 0)
                     ^
      108.           return 0;
      109.   

crypto/threads_pthread.c:108:9: 
      106.   {
      107.       if (pthread_once(once, init) != 0)
      108. >         return 0;
      109.   
      110.       return 1;

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
      109.   
      110.       return 1;
      111. > }
      112.   
      113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/engine/eng_init.c:84:10: Condition is false
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:84:10: Taking true branch
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:85:9: Skipping ERR_put_error(): empty list of specs
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
                  ^
    86.           return 0;
    87.       }

crypto/engine/eng_init.c:86:9: 
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86. >         return 0;
    87.       }
    88.       CRYPTO_THREAD_write_lock(global_engine_lock);

crypto/engine/eng_init.c:92:1: return from a call to ENGINE_init
    90.       CRYPTO_THREAD_unlock(global_engine_lock);
    91.       return ret;
    92. > }
    93.   
    94.   /* The API (locked) version of "finish" */

crypto/evp/digest.c:213:24: Taking true branch
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
                                ^
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/evp/digest.c:214:9: Skipping ERR_put_error(): empty list of specs
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
                 ^
  215.           return 0;
  216.       }

crypto/evp/digest.c:215:9: 
  213.       if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215. >         return 0;
  216.       }
  217.   #endif

crypto/evp/digest.c:261:1: return from a call to EVP_MD_CTX_copy_ex
  259.   
  260.       return 1;
  261. > }
  262.   
  263.   int EVP_Digest(const void *data, size_t count,

crypto/evp/p_verify.c:36:13: Taking false branch
34.           }
35.           rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);
36.           if (rv)
                  ^
37.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);
38.           EVP_MD_CTX_free(tmp_ctx);

crypto/evp/p_verify.c:38:9: 
36.           if (rv)
37.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);
38. >         EVP_MD_CTX_free(tmp_ctx);
39.           if (!rv)
40.               return 0;

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

crypto/mem.c:286:1: start of procedure CRYPTO_free()
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

crypto/mem.c:289:9: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:289:30: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
                   ^
    291.           return;
    292.       }

crypto/mem.c:291:9: 
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
    291. >         return;
    292.       }
    293.   

crypto/mem.c:305:1: return from a call to CRYPTO_free
    303.       free(str);
    304.   #endif
    305. > }
    306.   
    307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
                    unsigned int siglen, EVP_PKEY *pkey)
{
    unsigned char m[EVP_MAX_MD_SIZE];
    unsigned int m_len = 0;
    int i = 0;
    EVP_PKEY_CTX *pkctx = NULL;
    if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
        if (!EVP_DigestFinal_ex(ctx, m, &m_len))
            goto err;
    } else {
        int rv = 0;
        EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
        if (tmp_ctx == NULL) {
            EVPerr(EVP_F_EVP_VERIFYFINAL, ERR_R_MALLOC_FAILURE);
            return 0;
        }
        rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);
        if (rv)
            rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);
        EVP_MD_CTX_free(tmp_ctx);
        if (!rv)
            return 0;
    }
    i = -1;
    pkctx = EVP_PKEY_CTX_new(pkey, NULL);
    if (pkctx == NULL)
        goto err;
    if (EVP_PKEY_verify_init(pkctx) <= 0)
        goto err;
    if (EVP_PKEY_CTX_set_signature_md(pkctx, EVP_MD_CTX_md(ctx)) <= 0)
        goto err;
    i = EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len);
 err:
    EVP_PKEY_CTX_free(pkctx);
    return i;
}
['int EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf,\n                    unsigned int siglen, EVP_PKEY *pkey)\n{\n    unsigned char m[EVP_MAX_MD_SIZE];\n    unsigned int m_len = 0;\n    int i = 0;\n    EVP_PKEY_CTX *pkctx = NULL;\n    if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {\n        if (!EVP_DigestFinal_ex(ctx, m, &m_len))\n            goto err;\n    } else {\n        int rv = 0;\n        EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();\n        if (tmp_ctx == NULL) {\n            EVPerr(EVP_F_EVP_VERIFYFINAL, ERR_R_MALLOC_FAILURE);\n            return 0;\n        }\n        rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);\n        if (rv)\n            rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);\n        EVP_MD_CTX_free(tmp_ctx);\n        if (!rv)\n            return 0;\n    }\n    i = -1;\n    pkctx = EVP_PKEY_CTX_new(pkey, NULL);\n    if (pkctx == NULL)\n        goto err;\n    if (EVP_PKEY_verify_init(pkctx) <= 0)\n        goto err;\n    if (EVP_PKEY_CTX_set_signature_md(pkctx, EVP_MD_CTX_md(ctx)) <= 0)\n        goto err;\n    i = EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len);\n err:\n    EVP_PKEY_CTX_free(pkctx);\n    return i;\n}', 'int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)\n{\n    return (ctx->flags & flags);\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)\n{\n    unsigned char *tmp_buf;\n    if ((in == NULL) || (in->digest == NULL)) {\n        EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);\n        return 0;\n    }\n#ifndef OPENSSL_NO_ENGINE\n    if (in->engine && !ENGINE_init(in->engine)) {\n        EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);\n        return 0;\n    }\n#endif\n    if (out->digest == in->digest) {\n        tmp_buf = out->md_data;\n        EVP_MD_CTX_set_flags(out, EVP_MD_CTX_FLAG_REUSE);\n    } else\n        tmp_buf = NULL;\n    EVP_MD_CTX_reset(out);\n    memcpy(out, in, sizeof(*out));\n    out->md_data = NULL;\n    out->pctx = NULL;\n    if (in->md_data && out->digest->ctx_size) {\n        if (tmp_buf)\n            out->md_data = tmp_buf;\n        else {\n            out->md_data = OPENSSL_malloc(out->digest->ctx_size);\n            if (out->md_data == NULL) {\n                EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_MALLOC_FAILURE);\n                return 0;\n            }\n        }\n        memcpy(out->md_data, in->md_data, out->digest->ctx_size);\n    }\n    out->update = in->update;\n    if (in->pctx) {\n        out->pctx = EVP_PKEY_CTX_dup(in->pctx);\n        if (!out->pctx) {\n            EVP_MD_CTX_reset(out);\n            return 0;\n        }\n    }\n    if (out->digest->copy)\n        return out->digest->copy(out, in);\n    return 1;\n}', 'int ENGINE_init(ENGINE *e)\n{\n    int ret;\n    if (e == NULL) {\n        ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);\n        return 0;\n    }\n    if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {\n        ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);\n        return 0;\n    }\n    CRYPTO_THREAD_write_lock(global_engine_lock);\n    ret = engine_unlocked_init(e);\n    CRYPTO_THREAD_unlock(global_engine_lock);\n    return ret;\n}', 'int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))\n{\n    if (pthread_once(once, init) != 0)\n        return 0;\n    return 1;\n}', 'void EVP_MD_CTX_free(EVP_MD_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    INCREMENT(free_count);\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']