[PATCH] Fix memory management problem with appearBuf in Annot.

Julien Rebetez julien at fhtagn.net
Fri Oct 26 06:40:11 PDT 2007


---
 poppler/Annot.cc |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index a1bb227..b84fd87 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -332,9 +332,6 @@ Annot::~Annot() {
     delete type;
   }
   appearance.free();
-  if (appearBuf) {
-    delete appearBuf;
-  }
 
   if (borderStyle) {
     delete borderStyle;
@@ -709,11 +706,12 @@ void Annot::generateFieldAppearance(Dict *field, Dict *annot, Dict *acroForm) {
   drObj.free();
 
   // build the appearance stream
-  appearStream = new MemStream(appearBuf->getCString(), 0,
+  appearStream = new MemStream(strdup(appearBuf->getCString()), 0,
       appearBuf->getLength(), &appearDict);
   appearance.free();
   appearance.initStream(appearStream);
 
+  delete appearBuf;
 
   appearStream->setNeedFree(gTrue);
 
-- 
1.5.2.5


--------------030500050101040903030608
Content-Type: text/x-patch;
 name="0008-Adds-a-test-application-to-test-full-rewrite-functio.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0008-Adds-a-test-application-to-test-full-rewrite-functio.pa";
 filename*1="tch"



More information about the poppler mailing list