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


apps/verify.c:312:1: start of procedure load_untrusted()
310.   	}
311.   
312. > static STACK_OF(X509) *load_untrusted(char *certfile)
313.   {
314.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:314:2: 
312.   static STACK_OF(X509) *load_untrusted(char *certfile)
313.   {
314. > 	STACK_OF(X509_INFO) *sk=NULL;
315.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
316.   	BIO *in=NULL;

apps/verify.c:315:2: 
313.   {
314.   	STACK_OF(X509_INFO) *sk=NULL;
315. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
316.   	BIO *in=NULL;
317.   	X509_INFO *xi;

apps/verify.c:316:2: 
314.   	STACK_OF(X509_INFO) *sk=NULL;
315.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
316. > 	BIO *in=NULL;
317.   	X509_INFO *xi;
318.   

apps/verify.c:319:7: 
317.   	X509_INFO *xi;
318.   
319. > 	if(!(stack = sk_X509_new_null())) {
320.   		BIO_printf(bio_err,"memory allocation failure\n");
321.   		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:319:7: Taking false branch
317.   	X509_INFO *xi;
318.   
319.   	if(!(stack = sk_X509_new_null())) {
             ^
320.   		BIO_printf(bio_err,"memory allocation failure\n");
321.   		goto end;

apps/verify.c:324:7: Taking false branch
322.   	}
323.   
324.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
325.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
326.   		goto end;

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

apps/verify.c:336:9: 
334.   
335.   	/* scan over it and pull out the certs */
336. > 	while (sk_X509_INFO_num(sk))
337.   		{
338.   		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:336:9: Loop condition is true. Entering loop body
334.   
335.   	/* scan over it and pull out the certs */
336.   	while (sk_X509_INFO_num(sk))
               ^
337.   		{
338.   		xi=sk_X509_INFO_shift(sk);

apps/verify.c:338:3: 
336.   	while (sk_X509_INFO_num(sk))
337.   		{
338. > 		xi=sk_X509_INFO_shift(sk);
339.   		if (xi->x509 != NULL)
340.   			{

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:339:7: 
337.   		{
338.   		xi=sk_X509_INFO_shift(sk);
339. > 		if (xi->x509 != NULL)
340.   			{
341.   			sk_X509_push(stack,xi->x509);
