crypto/err/err.c:691: error: NULL_DEREFERENCE
  pointer `es` last assigned on line 689 could be null and is dereferenced at line 691, column 9.
Showing all 36 steps of the trace


crypto/err/err.c:684:1: start of procedure ERR_set_error_data()
682.   }
683.   
684. > void ERR_set_error_data(char *data, int flags)
685.   {
686.       ERR_STATE *es;

crypto/err/err.c:689:5: 
687.       int i;
688.   
689. >     es = ERR_get_state();
690.   
691.       i = es->top;

crypto/err/err.c:643:1: start of procedure ERR_get_state()
  641.   }
  642.   
  643. > ERR_STATE *ERR_get_state(void)
  644.   {
  645.       ERR_STATE *state = NULL;

crypto/err/err.c:645:5: 
  643.   ERR_STATE *ERR_get_state(void)
  644.   {
  645. >     ERR_STATE *state = NULL;
  646.   
  647.       if (!RUN_ONCE(&err_init, err_do_init))

crypto/err/err.c:647:10: 
  645.       ERR_STATE *state = NULL;
  646.   
  647. >     if (!RUN_ONCE(&err_init, err_do_init))
  648.           return NULL;
  649.   

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 false 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:68:5: 
    66.           return 0;
    67.   
    68. >     return 1;
    69.   }
    70.   

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:647:10: Condition is true
  645.       ERR_STATE *state = NULL;
  646.   
  647.       if (!RUN_ONCE(&err_init, err_do_init))
                  ^
  648.           return NULL;
  649.   

crypto/err/err.c:647:10: Taking false branch
  645.       ERR_STATE *state = NULL;
  646.   
  647.       if (!RUN_ONCE(&err_init, err_do_init))
                  ^
  648.           return NULL;
  649.   

crypto/err/err.c:650:5: 
  648.           return NULL;
  649.   
  650. >     state = CRYPTO_THREAD_get_local(&err_thread_local);
  651.   
  652.       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:652:9: Taking true branch
  650.       state = CRYPTO_THREAD_get_local(&err_thread_local);
  651.   
  652.       if (state == NULL) {
                 ^
  653.           state = OPENSSL_zalloc(sizeof(*state));
  654.           if (state == NULL)

crypto/err/err.c:653:9: 
  651.   
  652.       if (state == NULL) {
  653. >         state = OPENSSL_zalloc(sizeof(*state));
  654.           if (state == NULL)
  655.               return NULL;

crypto/mem.c:185:1: start of procedure CRYPTO_zalloc()
    183.   }
    184.   
    185. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    186.   {
    187.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:187:5: 
    185.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    186.   {
    187. >     void *ret = CRYPTO_malloc(num, file, line);
    188.   
    189.       FAILTEST();

crypto/mem.c:157:1: start of procedure CRYPTO_malloc()
      155.   #endif
      156.   
      157. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      158.   {
      159.       void *ret = NULL;

crypto/mem.c:159:5: 
      157.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      158.   {
      159. >     void *ret = NULL;
      160.   
      161.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:161:9: Taking false branch
      159.       void *ret = NULL;
      160.   
      161.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      162.           return malloc_impl(num, file, line);
      163.   

crypto/mem.c:164:9: Taking false branch
      162.           return malloc_impl(num, file, line);
      163.   
      164.       if (num <= 0)
                     ^
      165.           return NULL;
      166.   

crypto/mem.c:168:5: 
      166.   
      167.       FAILTEST();
      168. >     allow_customize = 0;
      169.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      170.       if (call_malloc_debug) {

crypto/mem.c:178:5: 
      176.       }
      177.   #else
      178. >     osslargused(file); osslargused(line);
      179.       ret = malloc(num);
      180.   #endif

crypto/mem.c:178:24: 
      176.       }
      177.   #else
      178. >     osslargused(file); osslargused(line);
      179.       ret = malloc(num);
      180.   #endif

crypto/mem.c:179:5: 
      177.   #else
      178.       osslargused(file); osslargused(line);
      179. >     ret = malloc(num);
      180.   #endif
      181.   

crypto/mem.c:182:5: 
      180.   #endif
      181.   
      182. >     return ret;
      183.   }
      184.   

crypto/mem.c:183:1: return from a call to CRYPTO_malloc
      181.   
      182.       return ret;
      183. > }
      184.   
      185.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:190:9: Taking false branch
    188.   
    189.       FAILTEST();
    190.       if (ret != NULL)
                   ^
    191.           memset(ret, 0, num);
    192.       return ret;

crypto/mem.c:192:5: 
    190.       if (ret != NULL)
    191.           memset(ret, 0, num);
    192. >     return ret;
    193.   }
    194.   

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

crypto/err/err.c:654:13: Taking true branch
  652.       if (state == NULL) {
  653.           state = OPENSSL_zalloc(sizeof(*state));
  654.           if (state == NULL)
                     ^
  655.               return NULL;
  656.   

crypto/err/err.c:655:13: 
  653.           state = OPENSSL_zalloc(sizeof(*state));
  654.           if (state == NULL)
  655. >             return NULL;
  656.   
  657.           if (!CRYPTO_THREAD_set_local(&err_thread_local, state)) {

crypto/err/err.c:668:1: return from a call to ERR_get_state
  666.   
  667.       return state;
  668. > }
  669.   
  670.   int ERR_get_next_error_library(void)

crypto/err/err.c:691:5: 
689.       es = ERR_get_state();
690.   
691. >     i = es->top;
692.       if (i == 0)
693.           i = ERR_NUM_ERRORS - 1;

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    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 (!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    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}']