crypto/ct/ct_log.c:227: error: NULL_DEREFERENCE
  pointer `load_ctx` last assigned on line 199 could be null and is dereferenced at line 227, column 16.
Showing all 27 steps of the trace


crypto/ct/ct_log.c:195:1: start of procedure CTLOG_STORE_load_file()
193.   }
194.   
195. > int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
196.   {
197.       int ret = 0;

crypto/ct/ct_log.c:197:5: 
195.   int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
196.   {
197. >     int ret = 0;
198.       char *enabled_logs;
199.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();

crypto/ct/ct_log.c:199:5: 
197.       int ret = 0;
198.       char *enabled_logs;
199. >     CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
200.   
201.       if (load_ctx == NULL)

crypto/ct/ct_log.c:57:1: start of procedure ctlog_store_load_ctx_new()
  55.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx);
  56.   
  57. > static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new()
  58.   {
  59.       CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/ct/ct_log.c:59:5: 
  57.   static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new()
  58.   {
  59. >     CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  60.   
  61.       if (ctx == NULL)

crypto/mem.c:198:1: start of procedure CRYPTO_zalloc()
    196.   }
    197.   
    198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:200:5: 
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200. >     void *ret = CRYPTO_malloc(num, file, line);
    201.   
    202.       FAILTEST();

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
      168.   #endif
      169.   
      170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172.       void *ret = NULL;

crypto/mem.c:172:5: 
      170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172. >     void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
      172.       void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      175.           return malloc_impl(num, file, line);
      176.   

crypto/mem.c:177:9: Taking false branch
      175.           return malloc_impl(num, file, line);
      176.   
      177.       if (num == 0)
                     ^
      178.           return NULL;
      179.   

crypto/mem.c:181:5: 
      179.   
      180.       FAILTEST();
      181. >     allow_customize = 0;
      182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:191:19: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:192:5: 
      190.   #else
      191.       (void)(file); (void)(line);
      192. >     ret = malloc(num);
      193.   #endif
      194.   

crypto/mem.c:195:5: 
      193.   #endif
      194.   
      195. >     return ret;
      196.   }
      197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
      194.   
      195.       return ret;
      196. > }
      197.   
      198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:203:9: Taking false branch
    201.   
    202.       FAILTEST();
    203.       if (ret != NULL)
                   ^
    204.           memset(ret, 0, num);
    205.       return ret;

crypto/mem.c:205:5: 
    203.       if (ret != NULL)
    204.           memset(ret, 0, num);
    205. >     return ret;
    206.   }
    207.   

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
    204.           memset(ret, 0, num);
    205.       return ret;
    206. > }
    207.   
    208.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:61:9: Taking true branch
  59.       CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  60.   
  61.       if (ctx == NULL)
                ^
  62.           CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE);
  63.   

crypto/ct/ct_log.c:62:9: Skipping ERR_put_error(): empty list of specs
  60.   
  61.       if (ctx == NULL)
  62.           CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE);
                ^
  63.   
  64.       return ctx;

crypto/ct/ct_log.c:64:5: 
  62.           CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE);
  63.   
  64. >     return ctx;
  65.   }
  66.   

crypto/ct/ct_log.c:65:1: return from a call to ctlog_store_load_ctx_new
  63.   
  64.       return ctx;
  65. > }
  66.   
  67.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)

crypto/ct/ct_log.c:201:9: Taking true branch
199.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
200.   
201.       if (load_ctx == NULL)
               ^
202.           goto end;
203.       load_ctx->log_store = store;

crypto/ct/ct_log.c:226:1: 
224.   
225.       ret = 1;
226. > end:
227.       NCONF_free(load_ctx->conf);
228.       ctlog_store_load_ctx_free(load_ctx);

crypto/ct/ct_log.c:227:5: 
225.       ret = 1;
226.   end:
227. >     NCONF_free(load_ctx->conf);
228.       ctlog_store_load_ctx_free(load_ctx);
229.       return ret;
