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


apps/x509.c:175:1: start of procedure x509_main()
173.   int MAIN(int, char **);
174.   
175. > int MAIN(int argc, char **argv)
176.   	{
177.   	ENGINE *e = NULL;

apps/x509.c:177:2: 
175.   int MAIN(int argc, char **argv)
176.   	{
177. > 	ENGINE *e = NULL;
178.   	int ret=1;
179.   	X509_REQ *req=NULL;

apps/x509.c:178:2: 
176.   	{
177.   	ENGINE *e = NULL;
178. > 	int ret=1;
179.   	X509_REQ *req=NULL;
180.   	X509 *x=NULL,*xca=NULL;

apps/x509.c:179:2: 
177.   	ENGINE *e = NULL;
178.   	int ret=1;
179. > 	X509_REQ *req=NULL;
180.   	X509 *x=NULL,*xca=NULL;
181.   	ASN1_OBJECT *objtmp;

apps/x509.c:180:2: 
178.   	int ret=1;
179.   	X509_REQ *req=NULL;
180. > 	X509 *x=NULL,*xca=NULL;
181.   	ASN1_OBJECT *objtmp;
182.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;

apps/x509.c:182:2: 
180.   	X509 *x=NULL,*xca=NULL;
181.   	ASN1_OBJECT *objtmp;
182. > 	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
183.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
184.   	ASN1_INTEGER *sno = NULL;

apps/x509.c:183:2: 
181.   	ASN1_OBJECT *objtmp;
182.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
183. > 	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
184.   	ASN1_INTEGER *sno = NULL;
185.   	int i,num,badops=0, badsig=0;

apps/x509.c:184:2: 
182.   	STACK_OF(OPENSSL_STRING) *sigopts = NULL;
183.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
184. > 	ASN1_INTEGER *sno = NULL;
185.   	int i,num,badops=0, badsig=0;
186.   	BIO *out=NULL;

apps/x509.c:185:2: 
183.   	EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL;
184.   	ASN1_INTEGER *sno = NULL;
185. > 	int i,num,badops=0, badsig=0;
186.   	BIO *out=NULL;
187.   	BIO *STDout=NULL;

apps/x509.c:186:2: 
184.   	ASN1_INTEGER *sno = NULL;
185.   	int i,num,badops=0, badsig=0;
186. > 	BIO *out=NULL;
187.   	BIO *STDout=NULL;
188.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;

apps/x509.c:187:2: 
185.   	int i,num,badops=0, badsig=0;
186.   	BIO *out=NULL;
187. > 	BIO *STDout=NULL;
188.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
189.   	int informat,outformat,keyformat,CAformat,CAkeyformat;

apps/x509.c:188:2: 
186.   	BIO *out=NULL;
187.   	BIO *STDout=NULL;
188. > 	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
189.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
190.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;

apps/x509.c:190:2: 
188.   	STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL;
189.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
190. > 	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
191.   	char *CAkeyfile=NULL,*CAserial=NULL;
192.   	char *fkeyfile=NULL;

apps/x509.c:191:2: 
189.   	int informat,outformat,keyformat,CAformat,CAkeyformat;
190.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
191. > 	char *CAkeyfile=NULL,*CAserial=NULL;
192.   	char *fkeyfile=NULL;
193.   	char *alias=NULL;

apps/x509.c:192:2: 
190.   	char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL;
191.   	char *CAkeyfile=NULL,*CAserial=NULL;
192. > 	char *fkeyfile=NULL;
193.   	char *alias=NULL;
194.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;

apps/x509.c:193:2: 
191.   	char *CAkeyfile=NULL,*CAserial=NULL;
192.   	char *fkeyfile=NULL;
193. > 	char *alias=NULL;
194.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
195.   	int next_serial=0;

apps/x509.c:194:2: 
192.   	char *fkeyfile=NULL;
193.   	char *alias=NULL;
194. > 	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
195.   	int next_serial=0;
196.   	int subject_hash=0,issuer_hash=0,ocspid=0;

apps/x509.c:195:2: 
193.   	char *alias=NULL;
194.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
195. > 	int next_serial=0;
196.   	int subject_hash=0,issuer_hash=0,ocspid=0;
197.   #ifndef OPENSSL_NO_MD5

apps/x509.c:196:2: 
194.   	int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0;
195.   	int next_serial=0;
196. > 	int subject_hash=0,issuer_hash=0,ocspid=0;
197.   #ifndef OPENSSL_NO_MD5
198.   	int subject_hash_old=0,issuer_hash_old=0;

apps/x509.c:198:2: 
196.   	int subject_hash=0,issuer_hash=0,ocspid=0;
197.   #ifndef OPENSSL_NO_MD5
198. > 	int subject_hash_old=0,issuer_hash_old=0;
199.   #endif
200.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;

apps/x509.c:200:2: 
198.   	int subject_hash_old=0,issuer_hash_old=0;
199.   #endif
200. > 	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
201.   	int ocsp_uri=0;
202.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;

apps/x509.c:201:2: 
199.   #endif
200.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
201. > 	int ocsp_uri=0;
202.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
203.   	int C=0;

apps/x509.c:202:2: 
200.   	int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
201.   	int ocsp_uri=0;
202. > 	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
203.   	int C=0;
204.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;

apps/x509.c:203:2: 
201.   	int ocsp_uri=0;
202.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
203. > 	int C=0;
204.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
205.   	int pprint = 0;

apps/x509.c:204:2: 
202.   	int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
203.   	int C=0;
204. > 	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
205.   	int pprint = 0;
206.   	const char **pp;

apps/x509.c:205:2: 
203.   	int C=0;
204.   	int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0;
205. > 	int pprint = 0;
206.   	const char **pp;
207.   	X509_STORE *ctx=NULL;

apps/x509.c:207:2: 
205.   	int pprint = 0;
206.   	const char **pp;
207. > 	X509_STORE *ctx=NULL;
208.   	X509_REQ *rq=NULL;
209.   	int fingerprint=0;

apps/x509.c:208:2: 
206.   	const char **pp;
207.   	X509_STORE *ctx=NULL;
208. > 	X509_REQ *rq=NULL;
209.   	int fingerprint=0;
210.   	char buf[256];

apps/x509.c:209:2: 
207.   	X509_STORE *ctx=NULL;
208.   	X509_REQ *rq=NULL;
209. > 	int fingerprint=0;
210.   	char buf[256];
211.   	const EVP_MD *md_alg,*digest=NULL;

apps/x509.c:211:2: 
209.   	int fingerprint=0;
210.   	char buf[256];
211. > 	const EVP_MD *md_alg,*digest=NULL;
212.   	CONF *extconf = NULL;
213.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;

apps/x509.c:212:2: 
210.   	char buf[256];
211.   	const EVP_MD *md_alg,*digest=NULL;
212. > 	CONF *extconf = NULL;
213.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
214.   	int need_rand = 0;

apps/x509.c:213:2: 
211.   	const EVP_MD *md_alg,*digest=NULL;
212.   	CONF *extconf = NULL;
213. > 	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
214.   	int need_rand = 0;
215.   	int checkend=0,checkoffset=0;

apps/x509.c:214:2: 
212.   	CONF *extconf = NULL;
213.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
214. > 	int need_rand = 0;
215.   	int checkend=0,checkoffset=0;
216.   	unsigned long nmflag = 0, certflag = 0;

apps/x509.c:215:2: 
213.   	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
214.   	int need_rand = 0;
215. > 	int checkend=0,checkoffset=0;
216.   	unsigned long nmflag = 0, certflag = 0;
217.   	unsigned char *checkhost = NULL, *checkemail = NULL;

apps/x509.c:216:2: 
214.   	int need_rand = 0;
215.   	int checkend=0,checkoffset=0;
216. > 	unsigned long nmflag = 0, certflag = 0;
217.   	unsigned char *checkhost = NULL, *checkemail = NULL;
218.   	char *checkip = NULL;

apps/x509.c:217:2: 
215.   	int checkend=0,checkoffset=0;
216.   	unsigned long nmflag = 0, certflag = 0;
217. > 	unsigned char *checkhost = NULL, *checkemail = NULL;
218.   	char *checkip = NULL;
219.   #ifndef OPENSSL_NO_ENGINE

apps/x509.c:218:2: 
216.   	unsigned long nmflag = 0, certflag = 0;
217.   	unsigned char *checkhost = NULL, *checkemail = NULL;
218. > 	char *checkip = NULL;
219.   #ifndef OPENSSL_NO_ENGINE
220.   	char *engine=NULL;

apps/x509.c:220:2: 
218.   	char *checkip = NULL;
219.   #ifndef OPENSSL_NO_ENGINE
220. > 	char *engine=NULL;
221.   #endif
222.   

apps/x509.c:223:2: 
221.   #endif
222.   
223. > 	reqfile=0;
224.   
225.   	apps_startup();

apps/x509.c:225:2: 
223.   	reqfile=0;
224.   
225. > 	apps_startup();
226.   
227.   	if (bio_err == NULL)

apps/x509.c:227:6: Taking false branch
225.   	apps_startup();
226.   
227.   	if (bio_err == NULL)
            ^
228.   		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
229.   

apps/x509.c:230:7: Taking true branch
228.   		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
229.   
230.   	if (!load_config(bio_err, NULL))
             ^
231.   		goto end;
232.   	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);

apps/x509.c:1137:1: 
1135.   		}
1136.   	ret=0;
1137. > end:
1138.   	if (need_rand)
1139.   		app_RAND_write_file(NULL, bio_err);

apps/x509.c:1138:6: Taking false branch
1136.   	ret=0;
1137.   end:
1138.   	if (need_rand)
             ^
1139.   		app_RAND_write_file(NULL, bio_err);
1140.   	OBJ_cleanup();

apps/x509.c:1140:2: 
1138.   	if (need_rand)
1139.   		app_RAND_write_file(NULL, bio_err);
1140. > 	OBJ_cleanup();
1141.   	NCONF_free(extconf);
1142.   	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:1141:2: 
1139.   		app_RAND_write_file(NULL, bio_err);
1140.   	OBJ_cleanup();
1141. > 	NCONF_free(extconf);
1142.   	BIO_free_all(out);
1143.   	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:1142:2: 
1140.   	OBJ_cleanup();
1141.   	NCONF_free(extconf);
1142. > 	BIO_free_all(out);
1143.   	BIO_free_all(STDout);
1144.   	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:1143:2: 
1141.   	NCONF_free(extconf);
1142.   	BIO_free_all(out);
1143. > 	BIO_free_all(STDout);
1144.   	X509_STORE_free(ctx);
1145.   	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:1144:2: 
1142.   	BIO_free_all(out);
1143.   	BIO_free_all(STDout);
1144. > 	X509_STORE_free(ctx);
1145.   	X509_REQ_free(req);
1146.   	X509_free(x);
