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


crypto/err/err.c:690:1: start of procedure ERR_set_error_data()
688.   }
689.   
690. > void ERR_set_error_data(char *data, int flags)
691.   {
692.       ERR_STATE *es;

crypto/err/err.c:695:5: 
693.       int i;
694.   
695. >     es = ERR_get_state();
696.   
697.       i = es->top;

crypto/err/err.c:652:1: start of procedure ERR_get_state()
  650.   }
  651.   
  652. > ERR_STATE *ERR_get_state(void)
  653.   {
  654.       ERR_STATE *state = NULL;

crypto/err/err.c:654:5: 
  652.   ERR_STATE *ERR_get_state(void)
  653.   {
  654. >     ERR_STATE *state = NULL;
  655.   
  656.       CRYPTO_THREAD_run_once(&err_init, err_do_init);

crypto/err/err.c:656:5: 
  654.       ERR_STATE *state = NULL;
  655.   
  656. >     CRYPTO_THREAD_run_once(&err_init, err_do_init);
  657.   
  658.       state = CRYPTO_THREAD_get_local(&err_thread_local);

crypto/threads_pthread.c:63:1: start of procedure CRYPTO_THREAD_run_once()
    61.   }
    62.   
    63. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    64.   {
    65.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:65:9: Taking true branch
    63.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    64.   {
    65.       if (pthread_once(once, init) != 0)
                  ^
    66.           return 0;
    67.   

crypto/threads_pthread.c:66:9: 
    64.   {
    65.       if (pthread_once(once, init) != 0)
    66. >         return 0;
    67.   
    68.       return 1;

crypto/threads_pthread.c:69:1: return from a call to CRYPTO_THREAD_run_once
    67.   
    68.       return 1;
    69. > }
    70.   
    71.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/err/err.c:658:5: 
  656.       CRYPTO_THREAD_run_once(&err_init, err_do_init);
  657.   
  658. >     state = CRYPTO_THREAD_get_local(&err_thread_local);
  659.   
  660.       if (state == NULL) {

crypto/threads_pthread.c:79:1: start of procedure CRYPTO_THREAD_get_local()
    77.   }
    78.   
    79. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    80.   {
    81.       return pthread_getspecific(*key);

crypto/threads_pthread.c:81:5: Skipping pthread_getspecific(): method has no implementation
    79.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
    80.   {
    81.       return pthread_getspecific(*key);
              ^
    82.   }
    83.   

crypto/threads_pthread.c:82:1: return from a call to CRYPTO_THREAD_get_local
    80.   {
    81.       return pthread_getspecific(*key);
    82. > }
    83.   
    84.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)

crypto/err/err.c:660:9: Taking true branch
  658.       state = CRYPTO_THREAD_get_local(&err_thread_local);
  659.   
  660.       if (state == NULL) {
                 ^
  661.           state = OPENSSL_zalloc(sizeof(*state));
  662.           if (state == NULL)

crypto/err/err.c:661:9: 
  659.   
  660.       if (state == NULL) {
  661. >         state = OPENSSL_zalloc(sizeof(*state));
  662.           if (state == NULL)
  663.               return NULL;

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/err/err.c:662:13: Taking false branch
  660.       if (state == NULL) {
  661.           state = OPENSSL_zalloc(sizeof(*state));
  662.           if (state == NULL)
                     ^
  663.               return NULL;
  664.   

crypto/err/err.c:665:14: 
  663.               return NULL;
  664.   
  665. >         if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {
  666.               ERR_STATE_free(state);
  667.               return NULL;

crypto/threads_pthread.c:84:1: start of procedure CRYPTO_THREAD_set_local()
    82.   }
    83.   
    84. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    85.   {
    86.       if (pthread_setspecific(*key, val) != 0)

crypto/threads_pthread.c:86:9: Taking false branch
    84.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
    85.   {
    86.       if (pthread_setspecific(*key, val) != 0)
                  ^
    87.           return 0;
    88.   

crypto/threads_pthread.c:89:5: 
    87.           return 0;
    88.   
    89. >     return 1;
    90.   }
    91.   

crypto/threads_pthread.c:90:1: return from a call to CRYPTO_THREAD_set_local
    88.   
    89.       return 1;
    90. > }
    91.   
    92.   int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)

crypto/err/err.c:665:14: Taking false branch
  663.               return NULL;
  664.   
  665.           if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {
                      ^
  666.               ERR_STATE_free(state);
  667.               return NULL;

crypto/err/err.c:671:9: Skipping OPENSSL_init_crypto(): empty list of specs
  669.   
  670.           /* Ignore failures from these */
  671.           OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
                 ^
  672.           ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);
  673.       }

crypto/err/err.c:672:9: Skipping ossl_init_thread_start(): empty list of specs
  670.           /* Ignore failures from these */
  671.           OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
  672.           ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE);
                 ^
  673.       }
  674.   

crypto/err/err.c:675:5: 
  673.       }
  674.   
  675. >     return state;
  676.   }
  677.   

crypto/err/err.c:676:1: return from a call to ERR_get_state
  674.   
  675.       return state;
  676. > }
  677.   
  678.   int ERR_get_next_error_library(void)

crypto/err/err.c:697:5: 
695.       es = ERR_get_state();
696.   
697. >     i = es->top;
698.       if (i == 0)
699.           i = ERR_NUM_ERRORS - 1;

crypto/err/err.c:698:9: Taking false branch
696.   
697.       i = es->top;
698.       if (i == 0)
               ^
699.           i = ERR_NUM_ERRORS - 1;
700.   

crypto/err/err.c:701:5: Taking true branch
699.           i = ERR_NUM_ERRORS - 1;
700.   
701.       err_clear_data(es, i);
           ^
702.       es->err_data[i] = data;
703.       es->err_data_flags[i] = flags;

crypto/mem.c:163:1: start of procedure CRYPTO_free()
  161.   }
  162.   
  163. > void CRYPTO_free(void *str, const char *file, int line)
  164.   {
  165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking false branch
  163.   void CRYPTO_free(void *str, const char *file, int line)
  164.   {
  165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  166.           free_impl(str, file, line);
  167.           return;

crypto/mem.c:179:5: 
  177.       }
  178.   #else
  179. >     free(str);
  180.   #endif
  181.   }

crypto/mem.c:181:1: return from a call to CRYPTO_free
  179.       free(str);
  180.   #endif
  181. > }
  182.   
  183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/err/err.c:701:5: Loop condition is false. Leaving loop
699.           i = ERR_NUM_ERRORS - 1;
700.   
701.       err_clear_data(es, i);
           ^
702.       es->err_data[i] = data;
703.       es->err_data_flags[i] = flags;

crypto/err/err.c:702:5: 
700.   
701.       err_clear_data(es, i);
702. >     es->err_data[i] = data;
703.       es->err_data_flags[i] = flags;
704.   }

crypto/err/err.c:703:5: 
701.       err_clear_data(es, i);
702.       es->err_data[i] = data;
703. >     es->err_data_flags[i] = flags;
704.   }
705.   

void ERR_set_error_data(char *data, int flags)
{
    ERR_STATE *es;
    int i;
    es = ERR_get_state();
    i = es->top;
    if (i == 0)
        i = ERR_NUM_ERRORS - 1;
    err_clear_data(es, i);
    es->err_data[i] = data;
    es->err_data_flags[i] = flags;
}
['void ERR_set_error_data(char *data, int flags)\n{\n    ERR_STATE *es;\n    int i;\n    es = ERR_get_state();\n    i = es->top;\n    if (i == 0)\n        i = ERR_NUM_ERRORS - 1;\n    err_clear_data(es, i);\n    es->err_data[i] = data;\n    es->err_data_flags[i] = flags;\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}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\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}']