Bug 690404 - memleak in preloadfont
Summary: memleak in preloadfont
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P4 normal
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-12 17:25 UTC by Krzysztof Kowalczyk
Modified: 2009-07-02 16:21 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.