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


crypto/err/err.c:373:1: start of procedure ERR_clear_error()
371.   }
372.   
373. > void ERR_clear_error(void)
374.   {
375.       int i;

crypto/err/err.c:378:5: 
376.       ERR_STATE *es;
377.   
378. >     es = ERR_get_state();
379.   
380.       for (i = 0; i < ERR_NUM_ERRORS; i++) {

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

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

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

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

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

crypto/err/err.c:650:9: 
  648.   
  649.       if (!RUN_ONCE(&err_init, err_do_init))
  650. >         return NULL;
  651.   
  652.       state = CRYPTO_THREAD_get_local(&err_thread_local);

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

crypto/err/err.c:380:10: 
378.       es = ERR_get_state();
379.   
380. >     for (i = 0; i < ERR_NUM_ERRORS; i++) {
381.           err_clear(es, i);
382.       }

crypto/err/err.c:380:17: Loop condition is true. Entering loop body
378.       es = ERR_get_state();
379.   
380.       for (i = 0; i < ERR_NUM_ERRORS; i++) {
                       ^
381.           err_clear(es, i);
382.       }

crypto/err/err.c:381:9: 
379.   
380.       for (i = 0; i < ERR_NUM_ERRORS; i++) {
381. >         err_clear(es, i);
382.       }
383.       es->top = es->bottom = 0;

void ERR_clear_error(void)
{
    int i;
    ERR_STATE *es;
    es = ERR_get_state();
    for (i = 0; i < ERR_NUM_ERRORS; i++) {
        err_clear(es, i);
    }
    es->top = es->bottom = 0;
}
['void ERR_clear_error(void)\n{\n    int i;\n    ERR_STATE *es;\n    es = ERR_get_state();\n    for (i = 0; i < ERR_NUM_ERRORS; i++) {\n        err_clear(es, i);\n    }\n    es->top = es->bottom = 0;\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}']