apps/crl2p7.c:258: error: NULL_DEREFERENCE
  pointer `xi` last assigned on line 257 could be null and is dereferenced at line 258, column 13.
Showing all 23 steps of the trace


apps/crl2p7.c:234:1: start of procedure add_certs_from_file()
232.    *----------------------------------------------------------------------
233.    */
234. > static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
235.   {
236.       BIO *in = NULL;

apps/crl2p7.c:236:5: 
234.   static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile)
235.   {
236. >     BIO *in = NULL;
237.       int count = 0;
238.       int ret = -1;

apps/crl2p7.c:237:5: 
235.   {
236.       BIO *in = NULL;
237. >     int count = 0;
238.       int ret = -1;
239.       STACK_OF(X509_INFO) *sk = NULL;

apps/crl2p7.c:238:5: 
236.       BIO *in = NULL;
237.       int count = 0;
238. >     int ret = -1;
239.       STACK_OF(X509_INFO) *sk = NULL;
240.       X509_INFO *xi;

apps/crl2p7.c:239:5: 
237.       int count = 0;
238.       int ret = -1;
239. >     STACK_OF(X509_INFO) *sk = NULL;
240.       X509_INFO *xi;
241.   

apps/crl2p7.c:242:5: Skipping BIO_new_file(): empty list of specs
240.       X509_INFO *xi;
241.   
242.       in = BIO_new_file(certfile, "r");
           ^
243.       if (in == NULL) {
244.           BIO_printf(bio_err, "error opening the file, %s\n", certfile);

apps/crl2p7.c:243:9: Taking false branch
241.   
242.       in = BIO_new_file(certfile, "r");
243.       if (in == NULL) {
               ^
244.           BIO_printf(bio_err, "error opening the file, %s\n", certfile);
245.           goto end;

apps/crl2p7.c:249:5: Skipping PEM_X509_INFO_read_bio(): empty list of specs
247.   
248.       /* This loads from a file, a stack of x509/crl/pkey sets */
249.       sk = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
           ^
250.       if (sk == NULL) {
251.           BIO_printf(bio_err, "error reading the file, %s\n", certfile);

apps/crl2p7.c:250:9: Taking false branch
248.       /* This loads from a file, a stack of x509/crl/pkey sets */
249.       sk = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL);
250.       if (sk == NULL) {
               ^
251.           BIO_printf(bio_err, "error reading the file, %s\n", certfile);
252.           goto end;

apps/crl2p7.c:256:12: Condition is true
254.   
255.       /* scan over it and pull out the CRL's */
256.       while (sk_X509_INFO_num(sk)) {
                  ^
257.           xi = sk_X509_INFO_shift(sk);
258.           if (xi->x509 != NULL) {

crypto/stack/stack.c:317:1: start of procedure sk_num()
  315.   }
  316.   
  317. > int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)

crypto/stack/stack.c:319:9: Taking false branch
  317.   int sk_num(const _STACK *st)
  318.   {
  319.       if (st == NULL)
                 ^
  320.           return -1;
  321.       return st->num;

crypto/stack/stack.c:321:5: 
  319.       if (st == NULL)
  320.           return -1;
  321. >     return st->num;
  322.   }
  323.   

crypto/stack/stack.c:322:1: return from a call to sk_num
  320.           return -1;
  321.       return st->num;
  322. > }
  323.   
  324.   void *sk_value(const _STACK *st, int i)

apps/crl2p7.c:256:12: Loop condition is true. Entering loop body
254.   
255.       /* scan over it and pull out the CRL's */
256.       while (sk_X509_INFO_num(sk)) {
                  ^
257.           xi = sk_X509_INFO_shift(sk);
258.           if (xi->x509 != NULL) {

apps/crl2p7.c:257:14: Condition is true
255.       /* scan over it and pull out the CRL's */
256.       while (sk_X509_INFO_num(sk)) {
257.           xi = sk_X509_INFO_shift(sk);
                    ^
258.           if (xi->x509 != NULL) {
259.               sk_X509_push(stack, xi->x509);

apps/crl2p7.c:257:9: 
255.       /* scan over it and pull out the CRL's */
256.       while (sk_X509_INFO_num(sk)) {
257. >         xi = sk_X509_INFO_shift(sk);
258.           if (xi->x509 != NULL) {
259.               sk_X509_push(stack, xi->x509);

crypto/stack/stack.c:269:1: start of procedure sk_shift()
  267.   }
  268.   
  269. > void *sk_shift(_STACK *st)
  270.   {
  271.       if (st == NULL)

crypto/stack/stack.c:271:9: Taking false branch
  269.   void *sk_shift(_STACK *st)
  270.   {
  271.       if (st == NULL)
                 ^
  272.           return (NULL);
  273.       if (st->num <= 0)

crypto/stack/stack.c:273:9: Taking true branch
  271.       if (st == NULL)
  272.           return (NULL);
  273.       if (st->num <= 0)
                 ^
  274.           return (NULL);
  275.       return (sk_delete(st, 0));

crypto/stack/stack.c:274:9: 
  272.           return (NULL);
  273.       if (st->num <= 0)
  274. >         return (NULL);
  275.       return (sk_delete(st, 0));
  276.   }

crypto/stack/stack.c:276:1: return from a call to sk_shift
  274.           return (NULL);
  275.       return (sk_delete(st, 0));
  276. > }
  277.   
  278.   void *sk_pop(_STACK *st)

apps/crl2p7.c:258:13: 
256.       while (sk_X509_INFO_num(sk)) {
257.           xi = sk_X509_INFO_shift(sk);
258. >         if (xi->x509 != NULL) {
259.               sk_X509_push(stack, xi->x509);
260.               xi->x509 = NULL;
