[poppler] utils/pdftotext.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 2 11:32:29 UTC 2018


 utils/pdftotext.cc |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 7c6c1fef6a7eab712ad335d63c5fe7ff05e6e59f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 2 13:32:01 2018 +0200

    pdftotext: Fix memory leak in printLine

diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 9844ba00..8fb42195 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -500,9 +500,11 @@ static void printLine(FILE *f, TextLine *line) {
     if (lineXMax < xMax) lineXMax = xMax;
     if (lineYMax < yMax) lineYMax = yMax;
 
-    const std::string myString = myXmlTokenReplace(word->getText()->getCString());
+    GooString *wordText = word->getText();
+    const std::string myString = myXmlTokenReplace(wordText->getCString());
     wordXML << "          <word xMin=\"" << xMin << "\" yMin=\"" << yMin << "\" xMax=\"" <<
             xMax << "\" yMax=\"" << yMax << "\">" << myString << "</word>\n";
+    delete wordText;
   }
   fprintf(f, "        <line xMin=\"%f\" yMin=\"%f\" xMax=\"%f\" yMax=\"%f\">\n",
           lineXMin, lineYMin, lineXMax, lineYMax);


More information about the poppler mailing list