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


apps/verify.c:272:1: start of procedure load_untrusted()
270.   	}
271.   
272. > static STACK_OF(X509) *load_untrusted(char *certfile)
273.   {
274.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:274:2: 
272.   static STACK_OF(X509) *load_untrusted(char *certfile)
273.   {
274. > 	STACK_OF(X509_INFO) *sk=NULL;
275.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
276.   	BIO *in=NULL;

apps/verify.c:275:2: 
273.   {
274.   	STACK_OF(X509_INFO) *sk=NULL;
275. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
276.   	BIO *in=NULL;
277.   	X509_INFO *xi;

apps/verify.c:276:2: 
274.   	STACK_OF(X509_INFO) *sk=NULL;
275.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
276. > 	BIO *in=NULL;
277.   	X509_INFO *xi;
278.   

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

apps/verify.c:284:7: Taking false branch
282.   	}
283.   
284.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
285.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
286.   		goto end;

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

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

apps/verify.c:298:3: 
296.   	while (sk_X509_INFO_num(sk))
297.   		{
298. > 		xi=sk_X509_INFO_shift(sk);
299.   		if (xi->x509 != NULL)
300.   			{

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:299:7: 
297.   		{
298.   		xi=sk_X509_INFO_shift(sk);
299. > 		if (xi->x509 != NULL)
300.   			{
301.   			sk_X509_push(stack,xi->x509);
