[gs-bugs] [Bug 690594] New: memleak in pdfdraw

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Fri Jul 3 00:40:20 PDT 2009


http://bugs.ghostscript.com/show_bug.cgi?id=690594

           Summary: memleak in pdfdraw
           Product: MuPDF
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P4
         Component: mupdf
        AssignedTo: tor.andersson at artifex.com
        ReportedBy: kkowalczyk at gmail.com
         QAContact: gs-bugs at ghostscript.com


pdfdraw doesn't close the xref, causing memleaks. It makes finding real memleaks
with valgrind harder.

Index: apps/pdfdraw.c
===================================================================
--- apps/pdfdraw.c	(revision 1201)
+++ apps/pdfdraw.c	(working copy)
@@ -80,6 +80,26 @@
 	fz_keepobj(xref->info);
 }
 
+void closexref(void)
+{
+	if (pagetree)
+	{
+		pdf_droppagetree(pagetree);
+		pagetree = nil;
+	}
+
+	if (xref)
+	{
+		if (xref->store)
+		{
+			pdf_dropstore(xref->store);
+			xref->store = nil;
+		}
+		pdf_closexref(xref);
+		xref = nil;
+	}
+}
+
 /*
  */
 
@@ -474,5 +494,6 @@
 	drawpages("1-");
 
     fz_droprenderer(drawgc);
+    closexref();
 }



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the gs-bugs mailing list