[poppler] [PATCH 2/5] Do not use objects just after deleting them

David Benjamin davidben at MIT.EDU
Thu Jan 21 21:27:00 PST 2010


The error condition in GfxCIDFont::GfxCIDFont references cMapName and
collection, so they should not be deleted yet.
---
 poppler/GfxFont.cc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index e7d564a..e14a7c2 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1489,13 +1489,15 @@ GfxCIDFont::GfxCIDFont(XRef *xref, char *tagA, Ref idA, GooString *nameA,
     cMapName = new GooString(obj1.getName());
     cMap = globalParams->getCMap(collection, cMapName);
   }
-  delete collection;
-  delete cMapName;
   if (!cMap) {
       error(-1, "Unknown CMap '%s' for character collection '%s'",
 	    cMapName->getCString(), collection->getCString());
+      delete collection;
+      delete cMapName;
       goto err2;
     }
+  delete collection;
+  delete cMapName;
   obj1.free();
 
   // CIDToGIDMap (for embedded TrueType fonts)
-- 
1.6.6.137.g8333d.dirty



More information about the poppler mailing list