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


crypto/err/err.c:679:1: start of procedure ERR_get_state()
677.   }
678.   
679. > ERR_STATE *ERR_get_state(void)
680.   {
681.       ERR_STATE *state = NULL;

crypto/err/err.c:681:5: 
679.   ERR_STATE *ERR_get_state(void)
680.   {
681. >     ERR_STATE *state = NULL;
682.   
683.       if (!RUN_ONCE(&err_init, err_do_init))

crypto/err/err.c:683:10: 
681.       ERR_STATE *state = NULL;
682.   
683. >     if (!RUN_ONCE(&err_init, err_do_init))
684.           return NULL;
685.   

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

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

crypto/threads_pthread.c:109:5: 
  107.           return 0;
  108.   
  109. >     return 1;
  110.   }
  111.   

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

crypto/err/err.c:683:10: Condition is true
681.       ERR_STATE *state = NULL;
682.   
683.       if (!RUN_ONCE(&err_init, err_do_init))
                ^
684.           return NULL;
685.   

crypto/err/err.c:683:10: Taking false branch
681.       ERR_STATE *state = NULL;
682.   
683.       if (!RUN_ONCE(&err_init, err_do_init))
                ^
684.           return NULL;
685.   

crypto/err/err.c:686:5: 
684.           return NULL;
685.   
686. >     state = CRYPTO_THREAD_get_local(&err_thread_local);
687.   
688.       if (state == NULL) {

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

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

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

crypto/err/err.c:688:9: Taking true branch
686.       state = CRYPTO_THREAD_get_local(&err_thread_local);
687.   
688.       if (state == NULL) {
               ^
689.           state = OPENSSL_zalloc(sizeof(*state));
690.           if (state == NULL)

crypto/err/err.c:689:9: 
687.   
688.       if (state == NULL) {
689. >         state = OPENSSL_zalloc(sizeof(*state));
690.           if (state == NULL)
691.               return NULL;

crypto/mem.c:194:1: start of procedure CRYPTO_zalloc()
  192.   }
  193.   
  194. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  195.   {
  196.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:196:5: 
  194.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  195.   {
  196. >     void *ret = CRYPTO_malloc(num, file, line);
  197.   
  198.       FAILTEST();

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

crypto/mem.c:168:5: 
    166.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    167.   {
    168. >     void *ret = NULL;
    169.   
    170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:170:9: Taking false branch
    168.       void *ret = NULL;
    169.   
    170.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    171.           return malloc_impl(num, file, line);
    172.   

crypto/mem.c:173:9: Taking false branch
    171.           return malloc_impl(num, file, line);
    172.   
    173.       if (num == 0)
                   ^
    174.           return NULL;
    175.   

crypto/mem.c:177:5: 
    175.   
    176.       FAILTEST();
    177. >     allow_customize = 0;
    178.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    179.       if (call_malloc_debug) {

crypto/mem.c:187:5: 
    185.       }
    186.   #else
    187. >     osslargused(file); osslargused(line);
    188.       ret = malloc(num);
    189.   #endif

crypto/mem.c:187:24: 
    185.       }
    186.   #else
    187. >     osslargused(file); osslargused(line);
    188.       ret = malloc(num);
    189.   #endif

crypto/mem.c:188:5: 
    186.   #else
    187.       osslargused(file); osslargused(line);
    188. >     ret = malloc(num);
    189.   #endif
    190.   

crypto/mem.c:191:5: 
    189.   #endif
    190.   
    191. >     return ret;
    192.   }
    193.   

crypto/mem.c:192:1: return from a call to CRYPTO_malloc
    190.   
    191.       return ret;
    192. > }
    193.   
    194.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:199:9: Taking true branch
  197.   
  198.       FAILTEST();
  199.       if (ret != NULL)
                 ^
  200.           memset(ret, 0, num);
  201.       return ret;

crypto/mem.c:200:9: 
  198.       FAILTEST();
  199.       if (ret != NULL)
  200. >         memset(ret, 0, num);
  201.       return ret;
  202.   }

crypto/mem.c:201:5: 
  199.       if (ret != NULL)
  200.           memset(ret, 0, num);
  201. >     return ret;
  202.   }
  203.   

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

crypto/err/err.c:690:13: Taking false branch
688.       if (state == NULL) {
689.           state = OPENSSL_zalloc(sizeof(*state));
690.           if (state == NULL)
                   ^
691.               return NULL;
692.   

crypto/err/err.c:693:14: 
691.               return NULL;
692.   
693. >         if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
694.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
695.               ERR_STATE_free(state);

crypto/init.c:363:1: start of procedure ossl_init_thread_start()
  361.   }
  362.   
  363. > int ossl_init_thread_start(uint64_t opts)
  364.   {
  365.       struct thread_local_inits_st *locals;

crypto/init.c:367:10: Taking true branch
  365.       struct thread_local_inits_st *locals;
  366.   
  367.       if (!OPENSSL_init_crypto(0, NULL))
                  ^
  368.           return 0;
  369.   

crypto/init.c:368:9: 
  366.   
  367.       if (!OPENSSL_init_crypto(0, NULL))
  368. >         return 0;
  369.   
  370.       locals = ossl_init_get_thread_local(1);

crypto/init.c:392:1: return from a call to ossl_init_thread_start
  390.   
  391.       return 1;
  392. > }
  393.   
  394.   void OPENSSL_cleanup(void)

crypto/err/err.c:693:14: Taking true branch
691.               return NULL;
692.   
693.           if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
                    ^
694.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
695.               ERR_STATE_free(state);

crypto/err/err.c:695:13: Skipping ERR_STATE_free(): empty list of specs
693.           if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE)
694.               || !CRYPTO_THREAD_set_local(&err_thread_local, state)) {
695.               ERR_STATE_free(state);
                   ^
696.               return NULL;
697.           }

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    osslargused(file); osslargused(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}']