apps/verify.c:305: error: NULL_DEREFERENCE
  pointer `in` last assigned on line 276 could be null and is dereferenced by call to `BIO_free()` at line 305, column 2.
Showing all 48 steps of the trace


apps/verify.c:264:1: start of procedure load_untrusted()
262.   	}
263.   
264. > static STACK_OF(X509) *load_untrusted(char *certfile)
265.   {
266.   	STACK_OF(X509_INFO) *sk=NULL;

apps/verify.c:266:2: 
264.   static STACK_OF(X509) *load_untrusted(char *certfile)
265.   {
266. > 	STACK_OF(X509_INFO) *sk=NULL;
267.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
268.   	BIO *in=NULL;

apps/verify.c:267:2: 
265.   {
266.   	STACK_OF(X509_INFO) *sk=NULL;
267. > 	STACK_OF(X509) *stack=NULL, *ret=NULL;
268.   	BIO *in=NULL;
269.   	X509_INFO *xi;

apps/verify.c:268:2: 
266.   	STACK_OF(X509_INFO) *sk=NULL;
267.   	STACK_OF(X509) *stack=NULL, *ret=NULL;
268. > 	BIO *in=NULL;
269.   	X509_INFO *xi;
270.   

apps/verify.c:271:7: 
269.   	X509_INFO *xi;
270.   
271. > 	if(!(stack = sk_X509_new_null())) {
272.   		BIO_printf(bio_err,"memory allocation failure\n");
273.   		goto end;

crypto/x509/x509_vfy.c:809:1: start of procedure sk_X509_new_null()
  807.   
  808.   
  809. > IMPLEMENT_STACK_OF(X509)
  810.   IMPLEMENT_ASN1_SET_OF(X509)
  811.   

crypto/x509/x509_vfy.c:809:1: return from a call to sk_X509_new_null
  807.   
  808.   
  809. > IMPLEMENT_STACK_OF(X509)
  810.   IMPLEMENT_ASN1_SET_OF(X509)
  811.   

apps/verify.c:271:7: Taking false branch
269.   	X509_INFO *xi;
270.   
271.   	if(!(stack = sk_X509_new_null())) {
             ^
272.   		BIO_printf(bio_err,"memory allocation failure\n");
273.   		goto end;

apps/verify.c:276:7: 
274.   	}
275.   
276. > 	if(!(in=BIO_new_file(certfile, "r"))) {
277.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
278.   		goto end;

crypto/bio/bss_file.c:97:1: start of procedure BIO_new_file()
  95.   	};
  96.   
  97. > BIO *BIO_new_file(const char *filename, const char *mode)
  98.   	{
  99.   	BIO *ret;

crypto/bio/bss_file.c:102:6: Taking true branch
  100.   	FILE *file;
  101.   
  102.   	if ((file=fopen(filename,mode)) == NULL)
              ^
  103.   		{
  104.   		SYSerr(SYS_F_FOPEN,get_last_sys_error());

crypto/bio/bss_file.c:104:3: 
  102.   	if ((file=fopen(filename,mode)) == NULL)
  103.   		{
  104. > 		SYSerr(SYS_F_FOPEN,get_last_sys_error());
  105.   		ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
  106.   		BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);

crypto/err/err.c:353:1: start of procedure ERR_put_error()
    351.   /********************************************************/
    352.   
    353. > void ERR_put_error(int lib, int func, int reason, const char *file,
    354.   	     int line)
    355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
    375.   	}
    376.   #endif
    377.   	es=ERR_get_state();
            ^
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
    377.   	es=ERR_get_state();
    378.   
    379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
                ^
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383. > 	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384. > 	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:385:2: Taking false branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}
            ^
    387.   
    388.   void ERR_clear_error(void)

crypto/bio/bss_file.c:105:3: Skipping ERR_add_error_data(): empty list of specs
  103.   		{
  104.   		SYSerr(SYS_F_FOPEN,get_last_sys_error());
  105.   		ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
           ^
  106.   		BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
  107.   		return(NULL);

crypto/bio/bss_file.c:106:3: 
  104.   		SYSerr(SYS_F_FOPEN,get_last_sys_error());
  105.   		ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
  106. > 		BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
  107.   		return(NULL);
  108.   		}

crypto/err/err.c:353:1: start of procedure ERR_put_error()
    351.   /********************************************************/
    352.   
    353. > void ERR_put_error(int lib, int func, int reason, const char *file,
    354.   	     int line)
    355.   	{

crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs
    375.   	}
    376.   #endif
    377.   	es=ERR_get_state();
            ^
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:379:2: 
    377.   	es=ERR_get_state();
    378.   
    379. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:380:6: Taking false branch
    378.   
    379.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    380.   	if (es->top == es->bottom)
                ^
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:382:2: 
    380.   	if (es->top == es->bottom)
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;

crypto/err/err.c:383:2: 
    381.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383. > 	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);

crypto/err/err.c:384:2: 
    382.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    383.   	es->err_file[es->top]=file;
    384. > 	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}

crypto/err/err.c:385:2: Taking true branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:385:2: Taking false branch
    383.   	es->err_file[es->top]=file;
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
            ^
    386.   	}
    387.   

crypto/err/err.c:386:2: return from a call to ERR_put_error
    384.   	es->err_line[es->top]=line;
    385.   	err_clear_data(es,es->top);
    386.   	}
            ^
    387.   
    388.   void ERR_clear_error(void)

crypto/bio/bss_file.c:107:3: 
  105.   		ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
  106.   		BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
  107. > 		return(NULL);
  108.   		}
  109.   	if ((ret=BIO_new(BIO_s_file_internal())) == NULL)

crypto/bio/bss_file.c:114:2: return from a call to BIO_new_file
  112.   	BIO_set_fp(ret,file,BIO_CLOSE);
  113.   	return(ret);
  114.   	}
          ^
  115.   
  116.   BIO *BIO_new_fp(FILE *stream, int close_flag)

apps/verify.c:276:7: Taking true branch
274.   	}
275.   
276.   	if(!(in=BIO_new_file(certfile, "r"))) {
             ^
277.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
278.   		goto end;

apps/verify.c:277:3: Skipping BIO_printf(): empty list of specs
275.   
276.   	if(!(in=BIO_new_file(certfile, "r"))) {
277.   		BIO_printf(bio_err,"error opening the file, %s\n",certfile);
         ^
278.   		goto end;
279.   	}

apps/verify.c:304:1: 
302.   	}
303.   	ret=stack;
304. > end:
305.   	BIO_free(in);
306.   	sk_X509_INFO_free(sk);

apps/verify.c:305:2: 
303.   	ret=stack;
304.   end:
305. > 	BIO_free(in);
306.   	sk_X509_INFO_free(sk);
307.   	return(ret);

crypto/bio/bio_lib.c:110:1: start of procedure BIO_free()
  108.   	}
  109.   
  110. > int BIO_free(BIO *a)
  111.   	{
  112.   	int ret=0,i;

crypto/bio/bio_lib.c:112:2: 
  110.   int BIO_free(BIO *a)
  111.   	{
  112. > 	int ret=0,i;
  113.   
  114.   	if (a == NULL) return(0);

crypto/bio/bio_lib.c:114:6: Taking false branch
  112.   	int ret=0,i;
  113.   
  114.   	if (a == NULL) return(0);
              ^
  115.   
  116.   	i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_BIO);

crypto/bio/bio_lib.c:116:2: 
  114.   	if (a == NULL) return(0);
  115.   
  116. > 	i=CRYPTO_add(&a->references,-1,CRYPTO_LOCK_BIO);
  117.   #ifdef REF_PRINT
  118.   	REF_PRINT("BIO",a);

crypto/cryptlib.c:227:1: start of procedure CRYPTO_add_lock()
    225.   	}
    226.   
    227. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
    228.   	     int line)
    229.   	{

crypto/cryptlib.c:232:6: Taking true branch
    230.   	int ret;
    231.   
    232.   	if (add_lock_callback != NULL)
                ^
    233.   		{
    234.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:238:3: Skipping __function_pointer__(): unresolved function pointer
    236.   #endif
    237.   
    238.   		ret=add_lock_callback(pointer,amount,type,file,line);
             ^
    239.   #ifdef LOCK_DEBUG
    240.   		fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n",

crypto/cryptlib.c:246:3: 
    244.   			file,line);
    245.   #endif
    246. > 		*pointer=ret;
    247.   		}
    248.   	else
