apps/ts.c:1087: error: NULL_DEREFERENCE
  pointer `cert_ctx` last assigned on line 1084 could be null and is dereferenced by call to `X509_STORE_set_verify_cb()` at line 1087, column 2.
Showing all 22 steps of the trace


apps/ts.c:1077:1: start of procedure create_cert_store()
1075.   	}
1076.   
1077. > static X509_STORE *create_cert_store(char *ca_path, char *ca_file)
1078.   	{
1079.   	X509_STORE *cert_ctx = NULL;

apps/ts.c:1079:2: 
1077.   static X509_STORE *create_cert_store(char *ca_path, char *ca_file)
1078.   	{
1079. > 	X509_STORE *cert_ctx = NULL;
1080.   	X509_LOOKUP *lookup = NULL;
1081.   	int i;

apps/ts.c:1080:2: 
1078.   	{
1079.   	X509_STORE *cert_ctx = NULL;
1080. > 	X509_LOOKUP *lookup = NULL;
1081.   	int i;
1082.   

apps/ts.c:1084:2: 
1082.   
1083.   	/* Creating the X509_STORE object. */
1084. > 	cert_ctx = X509_STORE_new();
1085.   
1086.   	/* Setting the callback for certificate chain verification. */

crypto/x509/x509_lu.c:178:1: start of procedure X509_STORE_new()
  176.   	}
  177.   
  178. > X509_STORE *X509_STORE_new(void)
  179.   	{
  180.   	X509_STORE *ret;

crypto/x509/x509_lu.c:182:6: 
  180.   	X509_STORE *ret;
  181.   
  182. > 	if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
  183.   		return NULL;
  184.   	ret->objs = sk_X509_OBJECT_new(x509_object_cmp);

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
    295.   	}
    296.   
    297. > void *CRYPTO_malloc(int num, const char *file, int line)
    298.   	{
    299.   	void *ret = NULL;

crypto/mem.c:299:2: 
    297.   void *CRYPTO_malloc(int num, const char *file, int line)
    298.   	{
    299. > 	void *ret = NULL;
    300.   
    301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
    299.   	void *ret = NULL;
    300.   
    301.   	if (num <= 0) return NULL;
                ^
    302.   
    303.   	allow_customize = 0;

crypto/mem.c:303:2: 
    301.   	if (num <= 0) return NULL;
    302.   
    303. > 	allow_customize = 0;
    304.   	if (malloc_debug_func != NULL)
    305.   		{

crypto/mem.c:304:6: Taking false branch
    302.   
    303.   	allow_customize = 0;
    304.   	if (malloc_debug_func != NULL)
                ^
    305.   		{
    306.   		allow_customize_debug = 0;

crypto/mem.c:309:2: Skipping __function_pointer__(): unresolved function pointer
    307.   		malloc_debug_func(NULL, num, file, line, 0);
    308.   		}
    309.   	ret = malloc_ex_func(num,file,line);
            ^
    310.   #ifdef LEVITTE_DEBUG_MEM
    311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:313:6: Taking false branch
    311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    312.   #endif
    313.   	if (malloc_debug_func != NULL)
                ^
    314.   		malloc_debug_func(ret, num, file, line, 1);
    315.   

crypto/mem.c:320:12: Taking false branch
    318.            * sanitisation function can't be optimised out. NB: We only do
    319.            * this for >2Kb so the overhead doesn't bother us. */
    320.           if(ret && (num > 2048))
                      ^
    321.   	{	extern unsigned char cleanse_ctr;
    322.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:326:2: 
    324.   #endif
    325.   
    326. > 	return ret;
    327.   	}
    328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:327:2: return from a call to CRYPTO_malloc
    325.   
    326.   	return ret;
    327.   	}
            ^
    328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
    329.   	{

crypto/x509/x509_lu.c:182:6: Taking true branch
  180.   	X509_STORE *ret;
  181.   
  182.   	if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
              ^
  183.   		return NULL;
  184.   	ret->objs = sk_X509_OBJECT_new(x509_object_cmp);

crypto/x509/x509_lu.c:183:3: 
  181.   
  182.   	if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL)
  183. > 		return NULL;
  184.   	ret->objs = sk_X509_OBJECT_new(x509_object_cmp);
  185.   	ret->cache=1;

crypto/x509/x509_lu.c:212:2: return from a call to X509_STORE_new
  210.   	ret->references=1;
  211.   	return ret;
  212.   	}
          ^
  213.   
  214.   static void cleanup(X509_OBJECT *a)

apps/ts.c:1087:2: 
1085.   
1086.   	/* Setting the callback for certificate chain verification. */
1087. > 	X509_STORE_set_verify_cb(cert_ctx, verify_cb);
1088.   
1089.   	/* Adding a trusted certificate directory source. */

crypto/x509/x509_lu.c:709:1: start of procedure X509_STORE_set_verify_cb()
  707.   	}
  708.   
  709. > void X509_STORE_set_verify_cb(X509_STORE *ctx,
  710.   				  int (*verify_cb)(int, X509_STORE_CTX *))
  711.   	{

crypto/x509/x509_lu.c:712:2: 
  710.   				  int (*verify_cb)(int, X509_STORE_CTX *))
  711.   	{
  712. > 	ctx->verify_cb = verify_cb;
  713.   	}
  714.   
