Bug 690411

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

Description Krzysztof Kowalczyk 2009-04-13 00:47:53 UTC
In some cases colorspace will be leaked

$ svn diff
Index: mupdf/pdf_image.c
===================================================================
--- mupdf/pdf_image.c   (revision 1077)
+++ mupdf/pdf_image.c   (working copy)
@@ -288,6 +288,7 @@
                if (!strcmp(cs->name, "Indexed"))
                {
                        pdf_logimage("indexed\n");
+                       fz_dropcolorspace(cs);
                        indexed = (pdf_indexed*)cs;
                        cs = indexed->base;
                        fz_keepcolorspace(cs);
Comment 1 Krzysztof Kowalczyk 2009-04-13 01:33:33 UTC
Patch above is incorrect. While leak is real and is fixed by the changed, it
also gets triggered in other code paths where it shouldn't.
Comment 2 Tor Andersson 2009-07-02 16:29:11 UTC
We need to refactor the image loading code, it's too fragile and doesn't work well with JPEG2000 
colorspace issues.