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


apps/verify.c:296:1: start of procedure load_untrusted()
294.   	}
295.   
296. > static STACK_OF(X509) *load_untrusted(char *certfile)
297.   {
298.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:298:2: 
296.   static STACK_OF(X509) *load_untrusted(char *certfile)
297.   {
298. > 	STACK_OF(X509_INFO) *sk=NULL;
299.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
300.   	BIO *in=NULL;

apps/verify.c:299:2: 
297.   {
298.   	STACK_OF(X509_INFO) *sk=NULL;
299. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
300.   	BIO *in=NULL;
301.   	X509_INFO *xi;

apps/verify.c:300:2: 
298.   	STACK_OF(X509_INFO) *sk=NULL;
299.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
300. > 	BIO *in=NULL;
301.   	X509_INFO *xi;
302.   

apps/verify.c:303:7: 
301.   	X509_INFO *xi;
302.   
303. > 	if(!(stack = sk_X509_new_null())) {
304.   		BIO_printf(bio_err,"memory allocation failure\n");
305.   		goto end;

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

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

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

apps/verify.c:303:7: Taking false branch
301.   	X509_INFO *xi;
302.   
303.   	if(!(stack = sk_X509_new_null())) {
             ^
304.   		BIO_printf(bio_err,"memory allocation failure\n");
305.   		goto end;

apps/verify.c:308:7: Taking false branch
306.   	}
307.   
308.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
309.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
310.   		goto end;

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

apps/verify.c:320:9: 
318.   
319.   	/* scan over it and pull out the certs */
320. > 	while (sk_X509_INFO_num(sk))
321.   		{
322.   		xi=sk_X509_INFO_shift(sk);

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

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

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

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

apps/verify.c:320:9: Loop condition is true. Entering loop body
318.   
319.   	/* scan over it and pull out the certs */
320.   	while (sk_X509_INFO_num(sk))
               ^
321.   		{
322.   		xi=sk_X509_INFO_shift(sk);

apps/verify.c:322:3: 
320.   	while (sk_X509_INFO_num(sk))
321.   		{
322. > 		xi=sk_X509_INFO_shift(sk);
323.   		if (xi->x509 != NULL)
324.   			{

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

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

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

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

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

apps/verify.c:323:7: 
321.   		{
322.   		xi=sk_X509_INFO_shift(sk);
323. > 		if (xi->x509 != NULL)
324.   			{
325.   			sk_X509_push(stack,xi->x509);
