[vlc-commits] [Git][videolan/vlc][master] qt: fix double free in QSGRoundedRectangularImageNode

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jul 31 12:08:24 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
6e6db6f4 by Fatih Uzunoglu at 2023-07-31T11:56:37+00:00
qt: fix double free in QSGRoundedRectangularImageNode

- - - - -


1 changed file:

- modules/gui/qt/util/qsgroundedrectangularimagenode.cpp


Changes:

=====================================
modules/gui/qt/util/qsgroundedrectangularimagenode.cpp
=====================================
@@ -186,7 +186,8 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
             painterPath.addRoundedRect(0, 0, key.first.first, key.first.second, key.second, key.second);
             painterPath = painterPath.simplified();
 
-            path = new QVector<QPointF>(painterPath.elementCount());
+            upPath = std::make_unique<QVector<QPointF>>(painterPath.elementCount());
+            path = upPath.get();
 
             const int elementCount = painterPath.elementCount();
             for (int i = 0; i < elementCount; ++i)
@@ -203,8 +204,7 @@ QSGGeometry* QSGRoundedRectangularImageNode::rebuildGeometry(const Shape& shape,
                                                             : (elementCount - i - 1)));
             }
 
-            if (!paths.insert(key, path))
-                upPath.reset(path); // Own the path so there is no leak
+            paths.insert(key, new QVector<QPointF>(*path));
         }
 
         vertexCount = path->count();



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e6db6f4bf12f38418b1cd44672ddbf5112c5e12

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6e6db6f4bf12f38418b1cd44672ddbf5112c5e12
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list