crypto/ct/ct_log.c:241: error: NULL_DEREFERENCE
  pointer `load_ctx` last assigned on line 239 could be null and is dereferenced at line 241, column 5.
Showing all 34 steps of the trace


crypto/ct/ct_log.c:235:1: start of procedure CTLOG_STORE_load_file()
233.   }
234.   
235. > int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
236.   {
237.       int ret = 0;

crypto/ct/ct_log.c:237:5: 
235.   int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
236.   {
237. >     int ret = 0;
238.       char *enabled_logs;
239.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();

crypto/ct/ct_log.c:239:5: 
237.       int ret = 0;
238.       char *enabled_logs;
239. >     CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
240.   
241.       load_ctx->log_store = store;

crypto/ct/ct_log.c:103:1: start of procedure ctlog_store_load_ctx_new()
  101.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx);
  102.   
  103. > static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new()
  104.   {
  105.       CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/ct/ct_log.c:105:5: 
  103.   static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new()
  104.   {
  105. >     CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  106.   
  107.       if (ctx == NULL) {

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking false branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:107:9: Taking true branch
  105.       CTLOG_STORE_LOAD_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  106.   
  107.       if (ctx == NULL) {
                 ^
  108.           CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE);
  109.           goto err;

crypto/ct/ct_log.c:108:9: Skipping ERR_put_error(): empty list of specs
  106.   
  107.       if (ctx == NULL) {
  108.           CTerr(CT_F_CTLOG_STORE_LOAD_CTX_NEW, ERR_R_MALLOC_FAILURE);
                 ^
  109.           goto err;
  110.       }

crypto/ct/ct_log.c:113:1: 
  111.   
  112.       return ctx;
  113. > err:
  114.       ctlog_store_load_ctx_free(ctx);
  115.       return NULL;

crypto/ct/ct_log.c:114:5: 
  112.       return ctx;
  113.   err:
  114. >     ctlog_store_load_ctx_free(ctx);
  115.       return NULL;
  116.   }

crypto/ct/ct_log.c:118:1: start of procedure ctlog_store_load_ctx_free()
    116.   }
    117.   
    118. > static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)
    119.   {
    120.       OPENSSL_free(ctx);

crypto/ct/ct_log.c:120:5: 
    118.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)
    119.   {
    120. >     OPENSSL_free(ctx);
    121.   }
    122.   

crypto/mem.c:210:1: start of procedure CRYPTO_free()
      208.   }
      209.   
      210. > void CRYPTO_free(void *str, const char *file, int line)
      211.   {
      212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:212:9: Taking false branch
      210.   void CRYPTO_free(void *str, const char *file, int line)
      211.   {
      212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      213.           free_impl(str, file, line);
      214.           return;

crypto/mem.c:226:5: 
      224.       }
      225.   #else
      226. >     free(str);
      227.   #endif
      228.   }

crypto/mem.c:228:1: return from a call to CRYPTO_free
      226.       free(str);
      227.   #endif
      228. > }
      229.   
      230.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:121:1: return from a call to ctlog_store_load_ctx_free
    119.   {
    120.       OPENSSL_free(ctx);
    121. > }
    122.   
    123.   /* Converts a log's public key into a SHA256 log ID */

crypto/ct/ct_log.c:115:5: 
  113.   err:
  114.       ctlog_store_load_ctx_free(ctx);
  115. >     return NULL;
  116.   }
  117.   

crypto/ct/ct_log.c:116:1: return from a call to ctlog_store_load_ctx_new
  114.       ctlog_store_load_ctx_free(ctx);
  115.       return NULL;
  116. > }
  117.   
  118.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)

crypto/ct/ct_log.c:241:5: 
239.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
240.   
241. >     load_ctx->log_store = store;
242.       load_ctx->conf = NCONF_new(NULL);
243.       if (load_ctx->conf == NULL)
