crypto/err/err.c:862: error: MEMORY_LEAK
  memory dynamically allocated by call to `ERR_get_state()` at line 858, column 10 is not reachable after line 862, column 5.
Showing all 44 steps of the trace


crypto/err/err.c:854:1: start of procedure ERR_set_mark()
852.   }
853.   
854. > int ERR_set_mark(void)
855.   {
856.       ERR_STATE *es;

crypto/err/err.c:858:5: 
856.       ERR_STATE *es;
857.   
858. >     es = ERR_get_state();
859.   
860.       if (es->bottom == es->top)

crypto/err/err.c:760:1: start of procedure ERR_get_state()
  758.   }
  759.   
  760. > ERR_STATE *ERR_get_state(void)
  761.   {
  762.       ERR_STATE *state = NULL;

crypto/err/err.c:762:5: 
  760.   ERR_STATE *ERR_get_state(void)
  761.   {
  762. >     ERR_STATE *state = NULL;
  763.   
  764.       CRYPTO_THREAD_run_once(&err_init, err_do_init);

crypto/err/err.c:764:5: 
  762.       ERR_STATE *state = NULL;
  763.   
  764. >     CRYPTO_THREAD_run_once(&err_init, err_do_init);
  765.   
  766.       state = CRYPTO_THREAD_get_local(&err_thread_local);

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 true 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:107:9: 
    105.   {
    106.       if (pthread_once(once, init) != 0)
    107. >         return 0;
    108.   
    109.       return 1;

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:766:5: 
  764.       CRYPTO_THREAD_run_once(&err_init, err_do_init);
  765.   
  766. >     state = CRYPTO_THREAD_get_local(&err_thread_local);
  767.   
  768.       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:768:9: Taking true branch
  766.       state = CRYPTO_THREAD_get_local(&err_thread_local);
  767.   
  768.       if (state == NULL) {
                 ^
  769.           state = OPENSSL_zalloc(sizeof(*state));
  770.           if (state == NULL)

crypto/err/err.c:769:9: 
  767.   
  768.       if (state == NULL) {
  769. >         state = OPENSSL_zalloc(sizeof(*state));
  770.           if (state == NULL)
  771.               return NULL;

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/err/err.c:770:13: Taking false branch
  768.       if (state == NULL) {
  769.           state = OPENSSL_zalloc(sizeof(*state));
  770.           if (state == NULL)
                     ^
  771.               return NULL;
  772.   

crypto/err/err.c:773:14: 
  771.               return NULL;
  772.   
  773. >         if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  774.               ERR_STATE_free(state);
  775.               return NULL;

crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local()
    123.   }
    124.   
    125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    126.   {
    127.       if (pthread_setspecific(*key, val) != 0)

crypto/threads_pthread.c:127:9: Taking false branch
    125.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    126.   {
    127.       if (pthread_setspecific(*key, val) != 0)
                   ^
    128.           return 0;
    129.   

crypto/threads_pthread.c:130:5: 
    128.           return 0;
    129.   
    130. >     return 1;
    131.   }
    132.   

crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local
    129.   
    130.       return 1;
    131. > }
    132.   
    133.   int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)

crypto/err/err.c:773:14: Taking false branch
  771.               return NULL;
  772.   
  773.           if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {
                      ^
  774.               ERR_STATE_free(state);
  775.               return NULL;

crypto/err/err.c:779:9: Skipping OPENSSL_init_crypto(): empty list of specs
  777.   
  778.           /* Ignore failures from these */
  779.           OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
                 ^
  780.           ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);
  781.       }

crypto/err/err.c:780:9: Skipping ossl_init_thread_start(): empty list of specs
  778.           /* Ignore failures from these */
  779.           OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  780.           ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);
                 ^
  781.       }
  782.   

crypto/err/err.c:783:5: 
  781.       }
  782.   
  783. >     return state;
  784.   }
  785.   

crypto/err/err.c:784:1: return from a call to ERR_get_state
  782.   
  783.       return state;
  784. > }
  785.   
  786.   int ERR_get_next_error_library(void)

crypto/err/err.c:860:9: Taking false branch
858.       es = ERR_get_state();
859.   
860.       if (es->bottom == es->top)
               ^
861.           return 0;
862.       es->err_flags[es->top] |= ERR_FLAG_MARK;

crypto/err/err.c:862:5: 
860.       if (es->bottom == es->top)
861.           return 0;
862. >     es->err_flags[es->top] |= ERR_FLAG_MARK;
863.       return 1;
864.   }

int ERR_set_mark(void)
{
    ERR_STATE *es;
    es = ERR_get_state();
    if (es->bottom == es->top)
        return 0;
    es->err_flags[es->top] |= ERR_FLAG_MARK;
    return 1;
}
['int ERR_set_mark(void)\n{\n    ERR_STATE *es;\n    es = ERR_get_state();\n    if (es->bottom == es->top)\n        return 0;\n    es->err_flags[es->top] |= ERR_FLAG_MARK;\n    return 1;\n}', 'ERR_STATE *ERR_get_state(void)\n{\n    ERR_STATE *state = NULL;\n    CRYPTO_THREAD_run_once(&err_init, err_do_init);\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 (!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        ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);\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    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    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 CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)\n{\n    if (pthread_setspecific(*key, val) != 0)\n        return 0;\n    return 1;\n}']