[poppler] poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Jan 28 02:07:27 PST 2010


 poppler/CairoOutputDev.cc |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 41a450c8db45fd064798d15c3d8fe5ab536a7b30
Author: David Benjamin <davidben at mit.edu>
Date:   Fri Jan 22 00:26:59 2010 -0500

    [cairo] Avoid leaving pointers to free'd memory
    
    Fixes potential free'd memory access introduced by
    3a94e8ce90c0a4d11c5c5aa8805c167c8a0434e5. I don't think this is actually
    possible in the current code; we push/pop before and after rendering a
    PDF, so the bottom state should never have a mask.
    
    Still, better to clean this up.

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index a2a9ae5..d6b32f3 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -272,10 +272,9 @@ void CairoOutputDev::restoreState(GfxState *state) {
   updateBlendMode(state);
 
   MaskStack* ms = maskStack;
-  if (mask)
-    cairo_pattern_destroy(mask);
-
   if (ms) {
+    if (mask)
+      cairo_pattern_destroy(mask);
     mask = ms->mask;
     maskStack = ms->next;
     delete ms;


More information about the poppler mailing list