[poppler] qt5/src qt6/src

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Mar 21 23:11:43 UTC 2021


 qt5/src/poppler-page.cc |    8 ++++++--
 qt6/src/poppler-page.cc |    8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 42dde686bf5a674401850b2d3fdd2bc7467e9a66
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Mar 22 00:03:59 2021 +0100

    qt: Fix memory leak when QImage constructor "fails"

diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 9f681722..c433ada4 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -1,7 +1,7 @@
 /* poppler-page.cc: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
- * Copyright (C) 2005-2020, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2021, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus at math.uni-koeln.de>
  * Copyright (C) 2006-2011, Pino Toscano <pino at kde.org>
  * Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -154,7 +154,11 @@ public:
 
             if (takeImageData) {
                 // Construct a Qt image holding (and also owning) the raw bitmap data.
-                return QImage(data, bw, bh, brs, format, gfree, data);
+                QImage i(data, bw, bh, brs, format, gfree, data);
+                if (i.isNull()) {
+                    gfree(data);
+                }
+                return i;
             } else {
                 return QImage(data, bw, bh, brs, format).copy();
             }
diff --git a/qt6/src/poppler-page.cc b/qt6/src/poppler-page.cc
index 0ad6c013..f1f4116c 100644
--- a/qt6/src/poppler-page.cc
+++ b/qt6/src/poppler-page.cc
@@ -1,7 +1,7 @@
 /* poppler-page.cc: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
- * Copyright (C) 2005-2020, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2021, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus at math.uni-koeln.de>
  * Copyright (C) 2006-2011, Pino Toscano <pino at kde.org>
  * Copyright (C) 2008 Carlos Garcia Campos <carlosgc at gnome.org>
@@ -154,7 +154,11 @@ public:
 
             if (takeImageData) {
                 // Construct a Qt image holding (and also owning) the raw bitmap data.
-                return QImage(data, bw, bh, brs, format, gfree, data);
+                QImage i(data, bw, bh, brs, format, gfree, data);
+                if (i.isNull()) {
+                    gfree(data);
+                }
+                return i;
             } else {
                 return QImage(data, bw, bh, brs, format).copy();
             }


More information about the poppler mailing list