From f15361390898f89198602ca21a3ac666c7d51d34 Mon Sep 17 00:00:00 2001 From: Nyall Dawson <nyall.dawson@gmail.com> Date: Mon, 25 Sep 2017 21:20:55 +1000 Subject: [PATCH] Fix memory leak when restoring invalid geometry collection wkt --- src/core/geometry/qgsgeometrycollection.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/geometry/qgsgeometrycollection.cpp b/src/core/geometry/qgsgeometrycollection.cpp index a45dc090038..418abcf0cbe 100644 --- a/src/core/geometry/qgsgeometrycollection.cpp +++ b/src/core/geometry/qgsgeometrycollection.cpp @@ -530,7 +530,10 @@ bool QgsGeometryCollection::fromCollectionWkt( const QString &wkt, const QList<Q QPair<QgsWkbTypes::Type, QString> parts = QgsGeometryUtils::wktReadBlock( wkt ); if ( QgsWkbTypes::flatType( parts.first ) != QgsWkbTypes::flatType( wkbType() ) ) + { + qDeleteAll( subtypes ); return false; + } mWkbType = parts.first; QString defChildWkbType = QStringLiteral( "%1%2%3 " ).arg( defaultChildWkbType, is3D() ? "Z" : "", isMeasure() ? "M" : "" );