apps/x509.c:1107: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 201 could be null and is dereferenced by call to `X509_STORE_free()` at line 1107, column 2.
Showing all 62 steps of the trace


apps/x509.c:169:1: start of procedure x509_main()
167.   int MAIN(int, char **);
168.   
169. > int MAIN(int argc, char **argv)
170.   	{
171.   	ENGINE *e = NULL;

apps/x509.c:171:2: 
169.   int MAIN(int argc, char **argv)
170.   	{
171. > 	ENGINE *e = NULL;
172.   	int ret=1;
173.   	X509_REQ *req=NULL;

apps/x509.c:172:2: 
170.   	{
171.   	ENGINE *e = NULL;
172. > 	int ret=1;
173.   	X509_REQ *req=NULL;
174.   	X509 *x=NULL,*xca=NULL;

apps/x509.c:173:2: 
171.   	ENGINE *e = NULL;
172.   	int ret=1;
173. > 	X509_REQ *req=NULL;
174.   	X509 *x=NULL,*xca=NULL;
175.   	ASN1_OBJECT *objtmp;

apps/x509.c:174:2: 
172.   	int ret=1;
173.   	X509_REQ *req=NULL;
174. > 	X509 *x=NULL,*xca=NULL;
175.   	ASN1_OBJECT *objtmp;
176.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;

apps/x509.c:176:2: 
174.   	X509 *x=NULL,*xca=NULL;
175.   	ASN1_OBJECT *objtmp;
176. > 	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
177.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
178.   	ASN1_INTEGER *sno = NULL;

apps/x509.c:177:2: 
175.   	ASN1_OBJECT *objtmp;
176.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
177. > 	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
178.   	ASN1_INTEGER *sno = NULL;
179.   	int i,num,badops=0;

apps/x509.c:178:2: 
176.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
177.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
178. > 	ASN1_INTEGER *sno = NULL;
179.   	int i,num,badops=0;
180.   	BIO *out=NULL;

apps/x509.c:179:2: 
177.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
178.   	ASN1_INTEGER *sno = NULL;
179. > 	int i,num,badops=0;
180.   	BIO *out=NULL;
181.   	BIO *STDout=NULL;

apps/x509.c:180:2: 
178.   	ASN1_INTEGER *sno = NULL;
179.   	int i,num,badops=0;
180. > 	BIO *out=NULL;
181.   	BIO *STDout=NULL;
182.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;

apps/x509.c:181:2: 
179.   	int i,num,badops=0;
180.   	BIO *out=NULL;
181. > 	BIO *STDout=NULL;
182.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
183.   	int informat,outformat,keyformat,CAformat,CAkeyformat;

apps/x509.c:182:2: 
180.   	BIO *out=NULL;
181.   	BIO *STDout=NULL;
182. > 	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
183.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
184.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;

apps/x509.c:184:2: 
182.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
183.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
184. > 	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
185.   	char *CAkeyfile=NULL,*CAserial=NULL;
186.   	char *fkeyfile=NULL;

apps/x509.c:185:2: 
183.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
184.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
185. > 	char *CAkeyfile=NULL,*CAserial=NULL;
186.   	char *fkeyfile=NULL;
187.   	char *alias=NULL;

apps/x509.c:186:2: 
184.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
185.   	char *CAkeyfile=NULL,*CAserial=NULL;
186. > 	char *fkeyfile=NULL;
187.   	char *alias=NULL;
188.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;

apps/x509.c:187:2: 
185.   	char *CAkeyfile=NULL,*CAserial=NULL;
186.   	char *fkeyfile=NULL;
187. > 	char *alias=NULL;
188.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
189.   	int next_serial=0;

apps/x509.c:188:2: 
186.   	char *fkeyfile=NULL;
187.   	char *alias=NULL;
188. > 	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
189.   	int next_serial=0;
190.   	int subject_hash=0,issuer_hash=0,ocspid=0;

apps/x509.c:189:2: 
187.   	char *alias=NULL;
188.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
189. > 	int next_serial=0;
190.   	int subject_hash=0,issuer_hash=0,ocspid=0;
191.   #ifndef OPENSSL_NO_MD5

apps/x509.c:190:2: 
188.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
189.   	int next_serial=0;
190. > 	int subject_hash=0,issuer_hash=0,ocspid=0;
191.   #ifndef OPENSSL_NO_MD5
192.   	int subject_hash_old=0,issuer_hash_old=0;

apps/x509.c:192:2: 
190.   	int subject_hash=0,issuer_hash=0,ocspid=0;
191.   #ifndef OPENSSL_NO_MD5
192. > 	int subject_hash_old=0,issuer_hash_old=0;
193.   #endif
194.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;

apps/x509.c:194:2: 
192.   	int subject_hash_old=0,issuer_hash_old=0;
193.   #endif
194. > 	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
195.   	int ocsp_uri=0;
196.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;

apps/x509.c:195:2: 
193.   #endif
194.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
195. > 	int ocsp_uri=0;
196.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
197.   	int C=0;

apps/x509.c:196:2: 
194.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
195.   	int ocsp_uri=0;
196. > 	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
197.   	int C=0;
198.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;

apps/x509.c:197:2: 
195.   	int ocsp_uri=0;
196.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
197. > 	int C=0;
198.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
199.   	int pprint = 0;

apps/x509.c:198:2: 
196.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
197.   	int C=0;
198. > 	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
199.   	int pprint = 0;
200.   	const char **pp;

apps/x509.c:199:2: 
197.   	int C=0;
198.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
199. > 	int pprint = 0;
200.   	const char **pp;
201.   	X509_STORE *ctx=NULL;

apps/x509.c:201:2: 
199.   	int pprint = 0;
200.   	const char **pp;
201. > 	X509_STORE *ctx=NULL;
202.   	X509_REQ *rq=NULL;
203.   	int fingerprint=0;

apps/x509.c:202:2: 
200.   	const char **pp;
201.   	X509_STORE *ctx=NULL;
202. > 	X509_REQ *rq=NULL;
203.   	int fingerprint=0;
204.   	char buf[256];

apps/x509.c:203:2: 
201.   	X509_STORE *ctx=NULL;
202.   	X509_REQ *rq=NULL;
203. > 	int fingerprint=0;
204.   	char buf[256];
205.   	const EVP_MD *md_alg,*digest=NULL;

apps/x509.c:205:2: 
203.   	int fingerprint=0;
204.   	char buf[256];
205. > 	const EVP_MD *md_alg,*digest=NULL;
206.   	CONF *extconf = NULL;
207.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;

apps/x509.c:206:2: 
204.   	char buf[256];
205.   	const EVP_MD *md_alg,*digest=NULL;
206. > 	CONF *extconf = NULL;
207.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
208.   	int need_rand = 0;

apps/x509.c:207:2: 
205.   	const EVP_MD *md_alg,*digest=NULL;
206.   	CONF *extconf = NULL;
207. > 	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
208.   	int need_rand = 0;
209.   	int checkend=0,checkoffset=0;

apps/x509.c:208:2: 
206.   	CONF *extconf = NULL;
207.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
208. > 	int need_rand = 0;
209.   	int checkend=0,checkoffset=0;
210.   	unsigned long nmflag = 0, certflag = 0;

apps/x509.c:209:2: 
207.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
208.   	int need_rand = 0;
209. > 	int checkend=0,checkoffset=0;
210.   	unsigned long nmflag = 0, certflag = 0;
211.   #ifndef OPENSSL_NO_ENGINE

apps/x509.c:210:2: 
208.   	int need_rand = 0;
209.   	int checkend=0,checkoffset=0;
210. > 	unsigned long nmflag = 0, certflag = 0;
211.   #ifndef OPENSSL_NO_ENGINE
212.   	char *engine=NULL;

apps/x509.c:212:2: 
210.   	unsigned long nmflag = 0, certflag = 0;
211.   #ifndef OPENSSL_NO_ENGINE
212. > 	char *engine=NULL;
213.   #endif
214.   

apps/x509.c:215:2: 
213.   #endif
214.   
215. > 	reqfile=0;
216.   
217.   	apps_startup();

apps/x509.c:217:2: 
215.   	reqfile=0;
216.   
217. > 	apps_startup();
218.   
219.   	if (bio_err == NULL)

apps/x509.c:219:6: Taking false branch
217.   	apps_startup();
218.   
219.   	if (bio_err == NULL)
            ^
220.   		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
221.   

apps/x509.c:222:7: Taking true branch
220.   		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
221.   
222.   	if (!load_config(bio_err, NULL))
             ^
223.   		goto end;
224.   	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);

apps/x509.c:1100:1: 
1098.   		}
1099.   	ret=0;
1100. > end:
1101.   	if (need_rand)
1102.   		app_RAND_write_file(NULL, bio_err);

apps/x509.c:1101:6: Taking false branch
1099.   	ret=0;
1100.   end:
1101.   	if (need_rand)
             ^
1102.   		app_RAND_write_file(NULL, bio_err);
1103.   	OBJ_cleanup();

apps/x509.c:1103:2: 
1101.   	if (need_rand)
1102.   		app_RAND_write_file(NULL, bio_err);
1103. > 	OBJ_cleanup();
1104.   	NCONF_free(extconf);
1105.   	BIO_free_all(out);

crypto/objects/obj_dat.c:222:1: start of procedure OBJ_cleanup()
  220.   	}
  221.   
  222. > void OBJ_cleanup(void)
  223.   	{
  224.   	if (obj_cleanup_defer)

crypto/objects/obj_dat.c:224:6: Taking false branch
  222.   void OBJ_cleanup(void)
  223.   	{
  224.   	if (obj_cleanup_defer)
              ^
  225.   		{
  226.   		obj_cleanup_defer = 2;

crypto/objects/obj_dat.c:229:6: Taking true branch
  227.   		return ;
  228.   		}
  229.   	if (added == NULL) return;
              ^
  230.   	lh_ADDED_OBJ_down_load(added) = 0;
  231.   	lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */

crypto/objects/obj_dat.c:229:21: 
  227.   		return ;
  228.   		}
  229. > 	if (added == NULL) return;
  230.   	lh_ADDED_OBJ_down_load(added) = 0;
  231.   	lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */

crypto/objects/obj_dat.c:236:2: return from a call to OBJ_cleanup
  234.   	lh_ADDED_OBJ_free(added);
  235.   	added=NULL;
  236.   	}
          ^
  237.   
  238.   int OBJ_new_nid(int num)

apps/x509.c:1104:2: 
1102.   		app_RAND_write_file(NULL, bio_err);
1103.   	OBJ_cleanup();
1104. > 	NCONF_free(extconf);
1105.   	BIO_free_all(out);
1106.   	BIO_free_all(STDout);

crypto/conf/conf_lib.c:251:1: start of procedure NCONF_free()
  249.   	}
  250.   
  251. > void NCONF_free(CONF *conf)
  252.   	{
  253.   	if (conf == NULL)

crypto/conf/conf_lib.c:253:6: Taking true branch
  251.   void NCONF_free(CONF *conf)
  252.   	{
  253.   	if (conf == NULL)
              ^
  254.   		return;
  255.   	conf->meth->destroy(conf);

crypto/conf/conf_lib.c:254:3: 
  252.   	{
  253.   	if (conf == NULL)
  254. > 		return;
  255.   	conf->meth->destroy(conf);
  256.   	}

crypto/conf/conf_lib.c:256:2: return from a call to NCONF_free
  254.   		return;
  255.   	conf->meth->destroy(conf);
  256.   	}
          ^
  257.   
  258.   void NCONF_free_data(CONF *conf)

apps/x509.c:1105:2: 
1103.   	OBJ_cleanup();
1104.   	NCONF_free(extconf);
1105. > 	BIO_free_all(out);
1106.   	BIO_free_all(STDout);
1107.   	X509_STORE_free(ctx);

crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all()
  504.   	}
  505.   
  506. > void BIO_free_all(BIO *bio)
  507.   	{
  508.   	BIO *b;

crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop
  509.   	int ref;
  510.   
  511.   	while (bio != NULL)
                 ^
  512.   		{
  513.   		b=bio;

crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all
  518.   		if (ref > 1) break;
  519.   		}
  520.   	}
          ^
  521.   
  522.   BIO *BIO_dup_chain(BIO *in)

apps/x509.c:1106:2: 
1104.   	NCONF_free(extconf);
1105.   	BIO_free_all(out);
1106. > 	BIO_free_all(STDout);
1107.   	X509_STORE_free(ctx);
1108.   	X509_REQ_free(req);

crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all()
  504.   	}
  505.   
  506. > void BIO_free_all(BIO *bio)
  507.   	{
  508.   	BIO *b;

crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop
  509.   	int ref;
  510.   
  511.   	while (bio != NULL)
                 ^
  512.   		{
  513.   		b=bio;

crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all
  518.   		if (ref > 1) break;
  519.   		}
  520.   	}
          ^
  521.   
  522.   BIO *BIO_dup_chain(BIO *in)

apps/x509.c:1107:2: 
1105.   	BIO_free_all(out);
1106.   	BIO_free_all(STDout);
1107. > 	X509_STORE_free(ctx);
1108.   	X509_REQ_free(req);
1109.   	X509_free(x);
