test/ct_test.c:299: error: NULL_DEREFERENCE
  pointer `ct_policy_ctx` last assigned on line 283 could be null and is dereferenced by call to `CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE()` at line 299, column 5.
Showing all 34 steps of the trace


test/ct_test.c:273:1: start of procedure execute_cert_test()
271.   }
272.   
273. > static int execute_cert_test(CT_TEST_FIXTURE fixture)
274.   {
275.       int success = 0;

test/ct_test.c:275:5: 
273.   static int execute_cert_test(CT_TEST_FIXTURE fixture)
274.   {
275. >     int success = 0;
276.       X509 *cert = NULL, *issuer = NULL;
277.       STACK_OF(SCT) *scts = NULL;

test/ct_test.c:276:5: 
274.   {
275.       int success = 0;
276. >     X509 *cert = NULL, *issuer = NULL;
277.       STACK_OF(SCT) *scts = NULL;
278.       SCT *sct = NULL;

test/ct_test.c:277:5: 
275.       int success = 0;
276.       X509 *cert = NULL, *issuer = NULL;
277. >     STACK_OF(SCT) *scts = NULL;
278.       SCT *sct = NULL;
279.       char expected_sct_text[CT_TEST_MAX_FILE_SIZE];

test/ct_test.c:278:5: 
276.       X509 *cert = NULL, *issuer = NULL;
277.       STACK_OF(SCT) *scts = NULL;
278. >     SCT *sct = NULL;
279.       char expected_sct_text[CT_TEST_MAX_FILE_SIZE];
280.       int sct_text_len = 0;

test/ct_test.c:280:5: 
278.       SCT *sct = NULL;
279.       char expected_sct_text[CT_TEST_MAX_FILE_SIZE];
280. >     int sct_text_len = 0;
281.       unsigned char *tls_sct_list = NULL;
282.       size_t tls_sct_list_len = 0;

test/ct_test.c:281:5: 
279.       char expected_sct_text[CT_TEST_MAX_FILE_SIZE];
280.       int sct_text_len = 0;
281. >     unsigned char *tls_sct_list = NULL;
282.       size_t tls_sct_list_len = 0;
283.       CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();

test/ct_test.c:282:5: 
280.       int sct_text_len = 0;
281.       unsigned char *tls_sct_list = NULL;
282. >     size_t tls_sct_list_len = 0;
283.       CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();
284.   

test/ct_test.c:283:5: 
281.       unsigned char *tls_sct_list = NULL;
282.       size_t tls_sct_list_len = 0;
283. >     CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();
284.   
285.       if (fixture.sct_text_file != NULL) {

crypto/ct/ct_policy.c:19:1: start of procedure CT_POLICY_EVAL_CTX_new()
  17.   #include "ct_locl.h"
  18.   
  19. > CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void)
  20.   {
  21.       CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));

crypto/ct/ct_policy.c:21:5: 
  19.   CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void)
  20.   {
  21. >     CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));
  22.   
  23.       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_policy.c:23:9: Taking true branch
  21.       CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));
  22.   
  23.       if (ctx == NULL) {
                ^
  24.           CTerr(CT_F_CT_POLICY_EVAL_CTX_NEW, ERR_R_MALLOC_FAILURE);
  25.           return NULL;

crypto/ct/ct_policy.c:24:9: Skipping ERR_put_error(): empty list of specs
  22.   
  23.       if (ctx == NULL) {
  24.           CTerr(CT_F_CT_POLICY_EVAL_CTX_NEW, ERR_R_MALLOC_FAILURE);
                ^
  25.           return NULL;
  26.       }

crypto/ct/ct_policy.c:25:9: 
  23.       if (ctx == NULL) {
  24.           CTerr(CT_F_CT_POLICY_EVAL_CTX_NEW, ERR_R_MALLOC_FAILURE);
  25. >         return NULL;
  26.       }
  27.   

crypto/ct/ct_policy.c:29:1: return from a call to CT_POLICY_EVAL_CTX_new
  27.   
  28.       return ctx;
  29. > }
  30.   
  31.   void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx)

test/ct_test.c:285:9: Taking false branch
283.       CT_POLICY_EVAL_CTX *ct_policy_ctx = CT_POLICY_EVAL_CTX_new();
284.   
285.       if (fixture.sct_text_file != NULL) {
               ^
286.           sct_text_len = read_text_file(fixture.sct_dir, fixture.sct_text_file,
287.                                         expected_sct_text,

test/ct_test.c:299:5: 
297.       }
298.   
299. >     CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(
300.               ct_policy_ctx, fixture.ctlog_store);
301.   

crypto/ct/ct_policy.c:56:1: start of procedure CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE()
  54.   }
  55.   
  56. > void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
  57.                                                  CTLOG_STORE *log_store)
  58.   {

crypto/ct/ct_policy.c:59:5: 
  57.                                                  CTLOG_STORE *log_store)
  58.   {
  59. >     ctx->log_store = log_store;
  60.   }
  61.   
