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


crypto/ct/ct_log.c:189:1: start of procedure CTLOG_STORE_load_file()
187.   }
188.   
189. > int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
190.   {
191.       int ret = 0;

crypto/ct/ct_log.c:191:5: 
189.   int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file)
190.   {
191. >     int ret = 0;
192.       char *enabled_logs;
193.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();

crypto/ct/ct_log.c:193:5: 
191.       int ret = 0;
192.       char *enabled_logs;
193. >     CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
194.   
195.       load_ctx->log_store = store;

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:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking false branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   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.           goto err;

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.           goto err;
  64.       }

crypto/ct/ct_log.c:67:1: 
  65.   
  66.       return ctx;
  67. > err:
  68.       ctlog_store_load_ctx_free(ctx);
  69.       return NULL;

crypto/ct/ct_log.c:68:5: 
  66.       return ctx;
  67.   err:
  68. >     ctlog_store_load_ctx_free(ctx);
  69.       return NULL;
  70.   }

crypto/ct/ct_log.c:72:1: start of procedure ctlog_store_load_ctx_free()
    70.   }
    71.   
    72. > static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)
    73.   {
    74.       OPENSSL_free(ctx);

crypto/ct/ct_log.c:74:5: 
    72.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)
    73.   {
    74. >     OPENSSL_free(ctx);
    75.   }
    76.   

crypto/mem.c:163:1: start of procedure CRYPTO_free()
      161.   }
      162.   
      163. > void CRYPTO_free(void *str, const char *file, int line)
      164.   {
      165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking false branch
      163.   void CRYPTO_free(void *str, const char *file, int line)
      164.   {
      165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      166.           free_impl(str, file, line);
      167.           return;

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     free(str);
      180.   #endif
      181.   }

crypto/mem.c:181:1: return from a call to CRYPTO_free
      179.       free(str);
      180.   #endif
      181. > }
      182.   
      183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:75:1: return from a call to ctlog_store_load_ctx_free
    73.   {
    74.       OPENSSL_free(ctx);
    75. > }
    76.   
    77.   /* Converts a log's public key into a SHA256 log ID */

crypto/ct/ct_log.c:69:5: 
  67.   err:
  68.       ctlog_store_load_ctx_free(ctx);
  69. >     return NULL;
  70.   }
  71.   

crypto/ct/ct_log.c:70:1: return from a call to ctlog_store_load_ctx_new
  68.       ctlog_store_load_ctx_free(ctx);
  69.       return NULL;
  70. > }
  71.   
  72.   static void ctlog_store_load_ctx_free(CTLOG_STORE_LOAD_CTX* ctx)

crypto/ct/ct_log.c:195:5: 
193.       CTLOG_STORE_LOAD_CTX* load_ctx = ctlog_store_load_ctx_new();
194.   
195. >     load_ctx->log_store = store;
196.       load_ctx->conf = NCONF_new(NULL);
197.       if (load_ctx->conf == NULL)
