Bug 690404

Summary: memleak in preloadfont
Product: MuPDF Reporter: Krzysztof Kowalczyk <kkowalczyk>
Component: mupdfAssignee: Tor Andersson <tor.andersson>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: unspecified   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---

Description Krzysztof Kowalczyk 2009-04-12 17:25:19 UTC
Reading the code, it looks like we should drop obj in preloadfont:

$ darcs diff -u
diff -rN -u old-mupdf-official/mupdf/pdf_resources.c
new-mupdf-official/mupdf/pdf_resources.c
--- old-mupdf-official/mupdf/pdf_resources.c    2009-04-12 17:24:20.578125000 -0700
+++ new-mupdf-official/mupdf/pdf_resources.c    2009-04-12 17:24:20.796875000 -0700
@@ -187,6 +187,7 @@
                return fz_rethrow(error, "cannot resolve font resource (%d %d
R)", fz_tonum(ref), fz_togen(ref));
        error = pdf_loadfont(&font, xref, obj, ref);
        pdf_dropfont(font); /* we did this just to fill the store, no need to
hold on to it */
+       fz_dropobj(obj);
        if (error)
                return fz_rethrow(error, "cannot load font resource (%d %d R)",
fz_tonum(ref), fz_togen(ref));
        return fz_okay;
Comment 1 Tor Andersson 2009-07-02 16:21:09 UTC
Fixed in the patch that added automatic resolving of indirect references.