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


apps/verify.c:264:1: start of procedure load_untrusted()
262.   	}
263.   
264. > static STACK_OF(X509) *load_untrusted(char *certfile)
265.   {
266.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:266:2: 
264.   static STACK_OF(X509) *load_untrusted(char *certfile)
265.   {
266. > 	STACK_OF(X509_INFO) *sk=NULL;
267.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
268.   	BIO *in=NULL;

apps/verify.c:267:2: 
265.   {
266.   	STACK_OF(X509_INFO) *sk=NULL;
267. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
268.   	BIO *in=NULL;
269.   	X509_INFO *xi;

apps/verify.c:268:2: 
266.   	STACK_OF(X509_INFO) *sk=NULL;
267.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
268. > 	BIO *in=NULL;
269.   	X509_INFO *xi;
270.   

apps/verify.c:271:7: Taking false branch
269.   	X509_INFO *xi;
270.   
271.   	if(!(stack = sk_X509_new_null())) {
             ^
272.   		BIO_printf(bio_err,"memory allocation failure\n");
273.   		goto end;

apps/verify.c:276:7: Taking false branch
274.   	}
275.   
276.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
277.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
278.   		goto end;

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

apps/verify.c:288:9: 
286.   
287.   	/* scan over it and pull out the certs */
288. > 	while (sk_X509_INFO_num(sk))
289.   		{
290.   		xi=sk_X509_INFO_shift(sk);

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   char *sk_value(const STACK *st, int i)

apps/verify.c:288:9: Loop condition is true. Entering loop body
286.   
287.   	/* scan over it and pull out the certs */
288.   	while (sk_X509_INFO_num(sk))
               ^
289.   		{
290.   		xi=sk_X509_INFO_shift(sk);

apps/verify.c:290:3: 
288.   	while (sk_X509_INFO_num(sk))
289.   		{
290. > 		xi=sk_X509_INFO_shift(sk);
291.   		if (xi->x509 != NULL)
292.   			{

crypto/stack/stack.c:254:1: start of procedure sk_shift()
  252.   	}
  253.   
  254. > char *sk_shift(STACK *st)
  255.   	{
  256.   	if (st == NULL) return(NULL);

crypto/stack/stack.c:256:6: Taking false branch
  254.   char *sk_shift(STACK *st)
  255.   	{
  256.   	if (st == NULL) return(NULL);
              ^
  257.   	if (st->num <= 0) return(NULL);
  258.   	return(sk_delete(st,0));

crypto/stack/stack.c:257:6: Taking true branch
  255.   	{
  256.   	if (st == NULL) return(NULL);
  257.   	if (st->num <= 0) return(NULL);
              ^
  258.   	return(sk_delete(st,0));
  259.   	}

crypto/stack/stack.c:257:20: 
  255.   	{
  256.   	if (st == NULL) return(NULL);
  257. > 	if (st->num <= 0) return(NULL);
  258.   	return(sk_delete(st,0));
  259.   	}

crypto/stack/stack.c:259:2: return from a call to sk_shift
  257.   	if (st->num <= 0) return(NULL);
  258.   	return(sk_delete(st,0));
  259.   	}
          ^
  260.   
  261.   char *sk_pop(STACK *st)

apps/verify.c:291:7: 
289.   		{
290.   		xi=sk_X509_INFO_shift(sk);
291. > 		if (xi->x509 != NULL)
292.   			{
293.   			sk_X509_push(stack,xi->x509);
