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


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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:321:1: start of procedure sk_num()
  319.   }
  320.   
  321. > int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)

crypto/stack/stack.c:323:9: Taking false branch
  321.   int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)
                 ^
  324.           return -1;
  325.       return st->num;

crypto/stack/stack.c:325:5: 
  323.       if (st == NULL)
  324.           return -1;
  325. >     return st->num;
  326.   }
  327.   

crypto/stack/stack.c:326:1: return from a call to sk_num
  324.           return -1;
  325.       return st->num;
  326. > }
  327.   
  328.   void *sk_value(const _STACK *st, int i)

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

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

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

crypto/stack/stack.c:273:1: start of procedure sk_shift()
  271.   }
  272.   
  273. > void *sk_shift(_STACK *st)
  274.   {
  275.       if (st == NULL)

crypto/stack/stack.c:275:9: Taking false branch
  273.   void *sk_shift(_STACK *st)
  274.   {
  275.       if (st == NULL)
                 ^
  276.           return (NULL);
  277.       if (st->num <= 0)

crypto/stack/stack.c:277:9: Taking true branch
  275.       if (st == NULL)
  276.           return (NULL);
  277.       if (st->num <= 0)
                 ^
  278.           return (NULL);
  279.       return (sk_delete(st, 0));

crypto/stack/stack.c:278:9: 
  276.           return (NULL);
  277.       if (st->num <= 0)
  278. >         return (NULL);
  279.       return (sk_delete(st, 0));
  280.   }

crypto/stack/stack.c:280:1: return from a call to sk_shift
  278.           return (NULL);
  279.       return (sk_delete(st, 0));
  280. > }
  281.   
  282.   void *sk_pop(_STACK *st)

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