crypto/ex_data.c:132: error: NULL_DEREFERENCE
  pointer `global` last assigned on line 114 could be null and is dereferenced at line 132, column 26.
Showing all 25 steps of the trace


crypto/ex_data.c:109:1: start of procedure crypto_free_ex_index_ex()
107.   }
108.   
109. > int crypto_free_ex_index_ex(OPENSSL_CTX *ctx, int class_index, int idx)
110.   {
111.       EX_CALLBACKS *ip = get_and_lock(ctx, class_index);

crypto/ex_data.c:111:5: 
109.   int crypto_free_ex_index_ex(OPENSSL_CTX *ctx, int class_index, int idx)
110.   {
111. >     EX_CALLBACKS *ip = get_and_lock(ctx, class_index);
112.       EX_CALLBACK *a;
113.       int toret = 0;

crypto/ex_data.c:28:1: start of procedure get_and_lock()
  26.    * a given class.  On success, *holds the lock.*
  27.    */
  28. > static EX_CALLBACKS *get_and_lock(OPENSSL_CTX *ctx, int class_index)
  29.   {
  30.       EX_CALLBACKS *ip;

crypto/ex_data.c:31:5: 
  29.   {
  30.       EX_CALLBACKS *ip;
  31. >     OSSL_EX_DATA_GLOBAL *global = NULL;
  32.   
  33.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {

crypto/ex_data.c:33:9: Taking false branch
  31.       OSSL_EX_DATA_GLOBAL *global = NULL;
  32.   
  33.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                ^
  34.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
  35.           return NULL;

crypto/ex_data.c:33:28: Taking true branch
  31.       OSSL_EX_DATA_GLOBAL *global = NULL;
  32.   
  33.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
                                   ^
  34.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
  35.           return NULL;

crypto/ex_data.c:34:9: Skipping ERR_put_error(): empty list of specs
  32.   
  33.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
  34.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
                ^
  35.           return NULL;
  36.       }

crypto/ex_data.c:35:9: 
  33.       if (class_index < 0 || class_index >= CRYPTO_EX_INDEX__COUNT) {
  34.           CRYPTOerr(CRYPTO_F_GET_AND_LOCK, ERR_R_PASSED_INVALID_ARGUMENT);
  35. >         return NULL;
  36.       }
  37.   

crypto/ex_data.c:55:1: return from a call to get_and_lock
  53.       CRYPTO_THREAD_write_lock(global->ex_data_lock);
  54.       return ip;
  55. > }
  56.   
  57.   static void cleanup_cb(EX_CALLBACK *funcs)

crypto/ex_data.c:113:5: 
111.       EX_CALLBACKS *ip = get_and_lock(ctx, class_index);
112.       EX_CALLBACK *a;
113. >     int toret = 0;
114.       OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
115.   

crypto/ex_data.c:114:5: 
112.       EX_CALLBACK *a;
113.       int toret = 0;
114. >     OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
115.   
116.       if (global == NULL)

crypto/context.c:211:1: start of procedure openssl_ctx_get_ex_data_global()
  209.   }
  210.   
  211. > OSSL_EX_DATA_GLOBAL *openssl_ctx_get_ex_data_global(OPENSSL_CTX *ctx)
  212.   {
  213.       /*

crypto/context.c:219:9: Taking true branch
  217.        */
  218.   #ifndef FIPS_MODE
  219.       if (ctx == NULL) {
                 ^
  220.           if (!RUN_ONCE(&default_context_init, do_default_context_init))
  221.               return NULL;

crypto/context.c:220:14: 
  218.   #ifndef FIPS_MODE
  219.       if (ctx == NULL) {
  220. >         if (!RUN_ONCE(&default_context_init, do_default_context_init))
  221.               return NULL;
  222.           ctx = default_context;

crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
    109.   }
    110.   
    111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    112.   {
    113.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:113:9: Taking true branch
    111.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    112.   {
    113.       if (pthread_once(once, init) != 0)
                   ^
    114.           return 0;
    115.   

crypto/threads_pthread.c:114:9: 
    112.   {
    113.       if (pthread_once(once, init) != 0)
    114. >         return 0;
    115.   
    116.       return 1;

crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
    115.   
    116.       return 1;
    117. > }
    118.   
    119.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/context.c:220:14: Condition is false
  218.   #ifndef FIPS_MODE
  219.       if (ctx == NULL) {
  220.           if (!RUN_ONCE(&default_context_init, do_default_context_init))
                      ^
  221.               return NULL;
  222.           ctx = default_context;

crypto/context.c:220:14: Taking true branch
  218.   #ifndef FIPS_MODE
  219.       if (ctx == NULL) {
  220.           if (!RUN_ONCE(&default_context_init, do_default_context_init))
                      ^
  221.               return NULL;
  222.           ctx = default_context;

crypto/context.c:221:13: 
  219.       if (ctx == NULL) {
  220.           if (!RUN_ONCE(&default_context_init, do_default_context_init))
  221. >             return NULL;
  222.           ctx = default_context;
  223.       }

crypto/context.c:228:1: return from a call to openssl_ctx_get_ex_data_global
  226.           return NULL;
  227.       return &ctx->global;
  228. > }
  229.   
  230.   int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,

crypto/ex_data.c:116:9: Taking true branch
114.       OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
115.   
116.       if (global == NULL)
               ^
117.           goto err;
118.   

crypto/ex_data.c:131:1: 
129.       a->free_func = dummy_free;
130.       toret = 1;
131. > err:
132.       CRYPTO_THREAD_unlock(global->ex_data_lock);
133.       return toret;

crypto/ex_data.c:132:5: 
130.       toret = 1;
131.   err:
132. >     CRYPTO_THREAD_unlock(global->ex_data_lock);
133.       return toret;
134.   }
