Bug 690605 - Fix memleak in jbig2 processing
Summary: Fix memleak in jbig2 processing
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: unspecified
Hardware: Macintosh MacOS X
: P4 normal
Assignee: Tor Andersson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-06 19:37 UTC by Krzysztof Kowalczyk
Modified: 2010-01-17 06:10 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-07-06 19:37:32 UTC
A recent change added creating global jbig2 context when processing some jbig2
images, but didn't add code to free it, creating a leak. This patch fixes it:

Index: fitz/filt_jbig2d.c
===================================================================
--- fitz/filt_jbig2d.c  (revision 1236)
+++ fitz/filt_jbig2d.c  (working copy)
@@ -46,6 +46,7 @@
 {
        FZ_NEWFILTER(fz_jbig2d, d, jbig2d);
        d->ctx = jbig2_ctx_new(nil, JBIG2_OPTIONS_EMBEDDED, nil, nil, nil);
+       d->gctx = nil;
        d->page = nil;
        d->idx = 0;
        return fz_okay;
@@ -56,6 +57,8 @@
 {
        fz_jbig2d *d = (fz_jbig2d*)filter;
        jbig2_ctx_free(d->ctx);
+       if (d->gctx)
+               jbig2_global_ctx_free(d->gctx);
 }