[poppler] utils/pdfsig.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Aug 28 22:48:40 UTC 2022


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

New commits:
commit 6b5437a07535d5fd07c114e71c2cbff9b2a2f454
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Aug 29 00:45:19 2022 +0200

    Fix memory leak in TextStringToUTF8

diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index a4fc35f8..1e4301fc 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -223,7 +223,7 @@ static std::string TextStringToUTF8(const std::string &str)
     const UnicodeMap *utf8Map = globalParams->getUtf8Map();
 
     Unicode *u;
-    int len = TextStringToUCS4(str, &u);
+    const int len = TextStringToUCS4(str, &u);
 
     std::string convertedStr;
     for (int i = 0; i < len; ++i) {
@@ -231,6 +231,7 @@ static std::string TextStringToUTF8(const std::string &str)
         const int n = utf8Map->mapUnicode(u[i], buf, sizeof(buf));
         convertedStr.append(buf, n);
     }
+    gfree(u);
 
     return convertedStr;
 }


More information about the poppler mailing list