[poppler] 3 commits - poppler/CharCodeToUnicode.cc qt/poppler-document.cc qt/poppler-link.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Nov 5 10:53:14 PST 2008


 poppler/CharCodeToUnicode.cc |    1 +
 qt/poppler-document.cc       |    4 +++-
 qt/poppler-link.cc           |    8 +++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit fc61dad9daa15f83802ffa5c3cd9b59d80bb310b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Nov 5 19:52:00 2008 +0100

    [Qt] Fix leak

diff --git a/qt/poppler-link.cc b/qt/poppler-link.cc
index deef9a4..1be7437 100644
--- a/qt/poppler-link.cc
+++ b/qt/poppler-link.cc
@@ -1,5 +1,5 @@
 /* poppler-link.cc: qt interface to poppler
- * Copyright (C) 2006, Albert Astals Cid
+ * Copyright (C) 2006, 2008 Albert Astals Cid
  * Adapting code from
  *   Copyright (C) 2004 by Enrico Ros <eros.kde at email.it>
  *
@@ -29,10 +29,14 @@ namespace Poppler {
 
 	LinkDestination::LinkDestination(const LinkDestinationData &data)
 	{
+		bool deleteDest = false;
 		LinkDest *ld = data.ld;
 		
 		if ( data.namedDest && !ld )
+		{
+			deleteDest = true;
 			ld = data.doc->doc.findDest( data.namedDest );
+		}
 		
 		if (!ld) return;
 		
@@ -72,6 +76,8 @@ namespace Poppler {
 		m_top = topAux;
 		m_right = rightAux;
 		m_bottom = bottomAux;
+		
+		if (deleteDest) delete ld;
 	}
 	
 	LinkDestination::LinkDestination(const QString &description)
commit 981fb857b0afb1cda7836744dcf37906285512b4
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Nov 5 19:49:18 2008 +0100

    [Qt] Fix memory leak

diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc
index 8b92397..50600ad 100644
--- a/qt/poppler-document.cc
+++ b/qt/poppler-document.cc
@@ -39,7 +39,9 @@ static GooString *QStringToGooString(const QString &s) {
     char *cstring = (char *)gmallocn(s.length(), sizeof(char));
     for (int i = 0; i < len; ++i)
       cstring[i] = s.at(i).unicode();
-    return new GooString(cstring, len);
+    GooString *ret = new GooString(cstring, len);
+    gfree(cstring);
+    return ret;
 }
 
 Document *Document::load(const QString &filePath)
commit e925e92d5cbfc009c138ece117227a3b0894ead6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Nov 5 19:44:40 2008 +0100

    Do not leak uBuf in the error case

diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index e7842e5..0cbb4d7 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -126,6 +126,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseUnicodeToUnicode(
   int line, n, i;
 
   if (!(f = fopen(fileName->getCString(), "r"))) {
+    gfree(uBuf);
     error(-1, "Couldn't open unicodeToUnicode file '%s'",
 	  fileName->getCString());
     return NULL;


More information about the poppler mailing list