Bug 691460

Summary: pdfapp_close have a bug
Product: MuPDF Reporter: akay <akay>
Component: appsAssignee: Tor Andersson <tor.andersson>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P4    
Version: unspecified   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---

Description akay 2010-07-15 06:58:36 UTC
pdfapp.c

on the function pdfapp_close(),

void pdfapp_close(pdfapp_t *app)
{
	if (app->cache)
		fz_freeglyphcache(app->cache);
	app->cache = nil;

	if (app->page)
		pdf_freepage(app->page);
	app->page = nil;

	if (app->image)
		fz_droppixmap(app->image);
	app->image = nil;

	if (app->outline)
		pdf_freeoutline(app->outline);
	app->outline = nil;

	if (app->xref->store)
		pdf_freestore(app->xref->store);
	app->xref->store = nil;

	pdf_closexref(app->xref);
	app->xref = nil;
}

when run here,maybe the application did not open pdf file,app->xref will NULL
	if (app->xref->store)
		pdf_freestore(app->xref->store);
	app->xref->store = nil;
	pdf_closexref(app->xref);

so,I think this will change to:
	if (app->xref)
	{
		if (app->xref->store)
			pdf_freestore(app->xref->store);
		app->xref->store = nil;
		pdf_closexref(app->xref);
	}

Please check it.