apps/apps.c:1577: error: NULL_DEREFERENCE
  pointer `store` last assigned on line 1555 could be null and is dereferenced by call to `X509_STORE_free()` at line 1577, column 2.
Showing all 4 steps of the trace


apps/apps.c:1551:1: start of procedure setup_verify()
1549.   }
1550.   
1551. > X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
1552.   {
1553.   	X509_STORE *store;

apps/apps.c:1555:7: Taking true branch
1553.   	X509_STORE *store;
1554.   	X509_LOOKUP *lookup;
1555.   	if(!(store = X509_STORE_new())) goto end;
              ^
1556.   	lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
1557.   	if (lookup == NULL) goto end;

apps/apps.c:1576:2: 
1574.   	ERR_clear_error();
1575.   	return store;
1576. > 	end:
1577.   	X509_STORE_free(store);
1578.   	return NULL;

apps/apps.c:1577:2: 
1575.   	return store;
1576.   	end:
1577. > 	X509_STORE_free(store);
1578.   	return NULL;
1579.   }

X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
{
	X509_STORE *store;
	X509_LOOKUP *lookup;
	if(!(store = X509_STORE_new())) goto end;
	lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
	if (lookup == NULL) goto end;
	if (CAfile) {
		if(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) {
			BIO_printf(bp, "Error loading file %s\n", CAfile);
			goto end;
		}
	} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
	lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());
	if (lookup == NULL) goto end;
	if (CApath) {
		if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) {
			BIO_printf(bp, "Error loading directory %s\n", CApath);
			goto end;
		}
	} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
	ERR_clear_error();
	return store;
	end:
	X509_STORE_free(store);
	return NULL;
}
['X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)\n{\n\tX509_STORE *store;\n\tX509_LOOKUP *lookup;\n\tif(!(store = X509_STORE_new())) goto end;\n\tlookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());\n\tif (lookup == NULL) goto end;\n\tif (CAfile) {\n\t\tif(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) {\n\t\t\tBIO_printf(bp, "Error loading file %s\\n", CAfile);\n\t\t\tgoto end;\n\t\t}\n\t} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);\n\tlookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());\n\tif (lookup == NULL) goto end;\n\tif (CApath) {\n\t\tif(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) {\n\t\t\tBIO_printf(bp, "Error loading directory %s\\n", CApath);\n\t\t\tgoto end;\n\t\t}\n\t} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);\n\tERR_clear_error();\n\treturn store;\n\tend:\n\tX509_STORE_free(store);\n\treturn NULL;\n}']