apps/verify.c:310: error: NULL_DEREFERENCE
  pointer `xi` last assigned on line 309 could be null and is dereferenced at line 310, column 7.
Showing all 24 steps of the trace


apps/verify.c:283:1: start of procedure load_untrusted()
281.   	}
282.   
283. > static STACK_OF(X509) *load_untrusted(char *certfile)
284.   {
285.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:285:2: 
283.   static STACK_OF(X509) *load_untrusted(char *certfile)
284.   {
285. > 	STACK_OF(X509_INFO) *sk=NULL;
286.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
287.   	BIO *in=NULL;

apps/verify.c:286:2: 
284.   {
285.   	STACK_OF(X509_INFO) *sk=NULL;
286. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
287.   	BIO *in=NULL;
288.   	X509_INFO *xi;

apps/verify.c:287:2: 
285.   	STACK_OF(X509_INFO) *sk=NULL;
286.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
287. > 	BIO *in=NULL;
288.   	X509_INFO *xi;
289.   

apps/verify.c:290:7: 
288.   	X509_INFO *xi;
289.   
290. > 	if(!(stack = sk_X509_new_null())) {
291.   		BIO_printf(bio_err,"memory allocation failure\n");
292.   		goto end;

crypto/stack/stack.c:112:1: start of procedure sk_new_null()
  110.   	}
  111.   
  112. > STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);

crypto/stack/stack.c:114:2: Skipping sk_new(): empty list of specs
  112.   STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
          ^
  115.   	}
  116.   

crypto/stack/stack.c:115:2: return from a call to sk_new_null
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
  115.   	}
          ^
  116.   
  117.   STACK *sk_new(int (*c)(const char * const *, const char * const *))

apps/verify.c:290:7: Taking false branch
288.   	X509_INFO *xi;
289.   
290.   	if(!(stack = sk_X509_new_null())) {
             ^
291.   		BIO_printf(bio_err,"memory allocation failure\n");
292.   		goto end;

apps/verify.c:295:7: Taking false branch
293.   	}
294.   
295.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
296.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
297.   		goto end;

apps/verify.c:301:7: Taking false branch
299.   
300.   	/* This loads from a file, a stack of x509/crl/pkey sets */
301.   	if(!(sk=PEM_X509_INFO_read_bio(in,NULL,NULL,NULL))) {
             ^
302.   		BIO_printf(bio_err,"error reading the file, %s\n",certfile);
303.   		goto end;

apps/verify.c:307:9: 
305.   
306.   	/* scan over it and pull out the certs */
307. > 	while (sk_X509_INFO_num(sk))
308.   		{
309.   		xi=sk_X509_INFO_shift(sk);

crypto/stack/stack.c:299:1: start of procedure sk_num()
  297.   	}
  298.   
  299. > int sk_num(const STACK *st)
  300.   {
  301.   	if(st == NULL) return -1;

crypto/stack/stack.c:301:5: Taking false branch
  299.   int sk_num(const STACK *st)
  300.   {
  301.   	if(st == NULL) return -1;
             ^
  302.   	return st->num;
  303.   }

crypto/stack/stack.c:302:2: 
  300.   {
  301.   	if(st == NULL) return -1;
  302. > 	return st->num;
  303.   }
  304.   

crypto/stack/stack.c:303:1: return from a call to sk_num
  301.   	if(st == NULL) return -1;
  302.   	return st->num;
  303. > }
  304.   
  305.   char *sk_value(const STACK *st, int i)

apps/verify.c:307:9: Loop condition is true. Entering loop body
305.   
306.   	/* scan over it and pull out the certs */
307.   	while (sk_X509_INFO_num(sk))
               ^
308.   		{
309.   		xi=sk_X509_INFO_shift(sk);

apps/verify.c:309:3: 
307.   	while (sk_X509_INFO_num(sk))
308.   		{
309. > 		xi=sk_X509_INFO_shift(sk);
310.   		if (xi->x509 != NULL)
311.   			{

crypto/stack/stack.c:259:1: start of procedure sk_shift()
  257.   	}
  258.   
  259. > char *sk_shift(STACK *st)
  260.   	{
  261.   	if (st == NULL) return(NULL);

crypto/stack/stack.c:261:6: Taking false branch
  259.   char *sk_shift(STACK *st)
  260.   	{
  261.   	if (st == NULL) return(NULL);
              ^
  262.   	if (st->num <= 0) return(NULL);
  263.   	return(sk_delete(st,0));

crypto/stack/stack.c:262:6: Taking true branch
  260.   	{
  261.   	if (st == NULL) return(NULL);
  262.   	if (st->num <= 0) return(NULL);
              ^
  263.   	return(sk_delete(st,0));
  264.   	}

crypto/stack/stack.c:262:20: 
  260.   	{
  261.   	if (st == NULL) return(NULL);
  262. > 	if (st->num <= 0) return(NULL);
  263.   	return(sk_delete(st,0));
  264.   	}

crypto/stack/stack.c:264:2: return from a call to sk_shift
  262.   	if (st->num <= 0) return(NULL);
  263.   	return(sk_delete(st,0));
  264.   	}
          ^
  265.   
  266.   char *sk_pop(STACK *st)

apps/verify.c:310:7: 
308.   		{
309.   		xi=sk_X509_INFO_shift(sk);
310. > 		if (xi->x509 != NULL)
311.   			{
312.   			sk_X509_push(stack,xi->x509);
