crypto/err/err.c:681: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 675, column 17 is not reachable after line 681, column 13.
Showing all 39 steps of the trace


crypto/err/err.c:665:1: start of procedure ERR_get_state()
663.   }
664.   
665. > ERR_STATE *ERR_get_state(void)
666.   {
667.       ERR_STATE *state = NULL;

crypto/err/err.c:667:5: 
665.   ERR_STATE *ERR_get_state(void)
666.   {
667. >     ERR_STATE *state = NULL;
668.   
669.       if (!RUN_ONCE(&err_init, err_do_init))

crypto/err/err.c:669:10: 
667.       ERR_STATE *state = NULL;
668.   
669. >     if (!RUN_ONCE(&err_init, err_do_init))
670.           return NULL;
671.   

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 false 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:110:5: 
  108.           return 0;
  109.   
  110. >     return 1;
  111.   }
  112.   

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/err/err.c:669:10: Condition is true
667.       ERR_STATE *state = NULL;
668.   
669.       if (!RUN_ONCE(&err_init, err_do_init))
                ^
670.           return NULL;
671.   

crypto/err/err.c:669:10: Taking false branch
667.       ERR_STATE *state = NULL;
668.   
669.       if (!RUN_ONCE(&err_init, err_do_init))
                ^
670.           return NULL;
671.   

crypto/err/err.c:672:5: 
670.           return NULL;
671.   
672. >     state = CRYPTO_THREAD_get_local(&err_thread_local);
673.   
674.       if (state == NULL) {

crypto/threads_pthread.c:121:1: start of procedure CRYPTO_THREAD_get_local()
  119.   }
  120.   
  121. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
  122.   {
  123.       return pthread_getspecific(*key);

crypto/threads_pthread.c:123:5: Skipping pthread_getspecific(): method has no implementation
  121.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
  122.   {
  123.       return pthread_getspecific(*key);
             ^
  124.   }
  125.   

crypto/threads_pthread.c:124:1: return from a call to CRYPTO_THREAD_get_local
  122.   {
  123.       return pthread_getspecific(*key);
  124. > }
  125.   
  126.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)

crypto/err/err.c:674:9: Taking true branch
672.       state = CRYPTO_THREAD_get_local(&err_thread_local);
673.   
674.       if (state == NULL) {
               ^
675.           state = OPENSSL_zalloc(sizeof(*state));
676.           if (state == NULL)

crypto/err/err.c:675:9: 
673.   
674.       if (state == NULL) {
675. >         state = OPENSSL_zalloc(sizeof(*state));
676.           if (state == NULL)
677.               return NULL;

crypto/mem.c:198:1: start of procedure CRYPTO_zalloc()
  196.   }
  197.   
  198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  199.   {
  200.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:200:5: 
  198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  199.   {
  200. >     void *ret = CRYPTO_malloc(num, file, line);
  201.   
  202.       FAILTEST();

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
    168.   #endif
    169.   
    170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172.       void *ret = NULL;

crypto/mem.c:172:5: 
    170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172. >     void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
    172.       void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    175.           return malloc_impl(num, file, line);
    176.   

crypto/mem.c:177:9: Taking false branch
    175.           return malloc_impl(num, file, line);
    176.   
    177.       if (num == 0)
                   ^
    178.           return NULL;
    179.   

crypto/mem.c:181:5: 
    179.   
    180.       FAILTEST();
    181. >     allow_customize = 0;
    182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:191:19: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:192:5: 
    190.   #else
    191.       (void)(file); (void)(line);
    192. >     ret = malloc(num);
    193.   #endif
    194.   

crypto/mem.c:195:5: 
    193.   #endif
    194.   
    195. >     return ret;
    196.   }
    197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
    194.   
    195.       return ret;
    196. > }
    197.   
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:203:9: Taking true branch
  201.   
  202.       FAILTEST();
  203.       if (ret != NULL)
                 ^
  204.           memset(ret, 0, num);
  205.       return ret;

crypto/mem.c:204:9: 
  202.       FAILTEST();
  203.       if (ret != NULL)
  204. >         memset(ret, 0, num);
  205.       return ret;
  206.   }

crypto/mem.c:205:5: 
  203.       if (ret != NULL)
  204.           memset(ret, 0, num);
  205. >     return ret;
  206.   }
  207.   

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
  204.           memset(ret, 0, num);
  205.       return ret;
  206. > }
  207.   
  208.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/err/err.c:676:13: Taking false branch
674.       if (state == NULL) {
675.           state = OPENSSL_zalloc(sizeof(*state));
676.           if (state == NULL)
                   ^
677.               return NULL;
678.   

crypto/err/err.c:679:14: 
677.               return NULL;
678.   
679. >         if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
680.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
681.               ERR_STATE_free(state);

crypto/init.c:377:1: start of procedure ossl_init_thread_start()
  375.   }
  376.   
  377. > int ossl_init_thread_start(uint64_t opts)
  378.   {
  379.       struct thread_local_inits_st *locals;

crypto/init.c:381:10: Taking true branch
  379.       struct thread_local_inits_st *locals;
  380.   
  381.       if (!OPENSSL_init_crypto(0, NULL))
                  ^
  382.           return 0;
  383.   

crypto/init.c:382:9: 
  380.   
  381.       if (!OPENSSL_init_crypto(0, NULL))
  382. >         return 0;
  383.   
  384.       locals = ossl_init_get_thread_local(1);

crypto/init.c:406:1: return from a call to ossl_init_thread_start
  404.   
  405.       return 1;
  406. > }
  407.   
  408.   void OPENSSL_cleanup(void)

crypto/err/err.c:679:14: Taking true branch
677.               return NULL;
678.   
679.           if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
                    ^
680.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
681.               ERR_STATE_free(state);

crypto/err/err.c:681:13: Skipping ERR_STATE_free(): empty list of specs
679.           if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
680.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
681.               ERR_STATE_free(state);
                   ^
682.               return NULL;
683.           }

ERR_STATE *ERR_get_state(void)
{
    ERR_STATE *state = NULL;
    if (!RUN_ONCE(&err_init, err_do_init))
        return NULL;
    state = CRYPTO_THREAD_get_local(&err_thread_local);
    if (state == NULL) {
        state = OPENSSL_zalloc(sizeof(*state));
        if (state == NULL)
            return NULL;
        if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
            || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
            ERR_STATE_free(state);
            return NULL;
        }
        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
    }
    return state;
}
['ERR_STATE *ERR_get_state(void)\n{\n    ERR_STATE *state = NULL;\n    if (!RUN_ONCE(&err_init, err_do_init))\n        return NULL;\n    state = CRYPTO_THREAD_get_local(&err_thread_local);\n    if (state == NULL) {\n        state = OPENSSL_zalloc(sizeof(*state));\n        if (state == NULL)\n            return NULL;\n        if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)\n            || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {\n            ERR_STATE_free(state);\n            return NULL;\n        }\n        OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);\n    }\n    return state;\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 *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)\n{\n    return pthread_getspecific(*key);\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    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 ossl_init_thread_start(uint64_t opts)\n{\n    struct thread_local_inits_st *locals;\n    if (!OPENSSL_init_crypto(0, NULL))\n        return 0;\n    locals = ossl_init_get_thread_local(1);\n    if (locals == NULL)\n        return 0;\n    if (opts & OPENSSL_INIT_THREAD_ASYNC) {\n#ifdef OPENSSL_INIT_DEBUG\n        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "\n                        "marking thread for async\\n");\n#endif\n        locals->async = 1;\n    }\n    if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {\n#ifdef OPENSSL_INIT_DEBUG\n        fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "\n                        "marking thread for err_state\\n");\n#endif\n        locals->err_state = 1;\n    }\n    return 1;\n}']