crypto/err/err.c:763: error: NULL_DEREFERENCE
  pointer `es` last assigned on line 761 could be null and is dereferenced at line 763, column 12.
Showing all 14 steps of the trace


crypto/err/err.c:757:1: start of procedure ERR_pop_to_mark()
755.   }
756.   
757. > int ERR_pop_to_mark(void)
758.   {
759.       ERR_STATE *es;

crypto/err/err.c:761:5: 
759.       ERR_STATE *es;
760.   
761. >     es = ERR_get_state();
762.   
763.       while (es->bottom != es->top

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

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

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

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

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

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

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

crypto/err/err.c:763:12: 
761.       es = ERR_get_state();
762.   
763. >     while (es->bottom != es->top
764.              && (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {
765.           err_clear(es, es->top);

int ERR_pop_to_mark(void)
{
    ERR_STATE *es;
    es = ERR_get_state();
    while (es->bottom != es->top
           && (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {
        err_clear(es, es->top);
        es->top -= 1;
        if (es->top == -1)
            es->top = ERR_NUM_ERRORS - 1;
    }
    if (es->bottom == es->top)
        return 0;
    es->err_flags[es->top] &= ~ERR_FLAG_MARK;
    return 1;
}
['int ERR_pop_to_mark(void)\n{\n    ERR_STATE *es;\n    es = ERR_get_state();\n    while (es->bottom != es->top\n           && (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {\n        err_clear(es, es->top);\n        es->top -= 1;\n        if (es->top == -1)\n            es->top = ERR_NUM_ERRORS - 1;\n    }\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    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}']