Skip to content
Permalink
Browse files

Fix memory leak when inserting invalid geometries

  • Loading branch information
nyalldawson committed Sep 25, 2017
1 parent 307efe3 commit b46d8d3d33e864f033b72f1d83e8330a7bc621f8
Showing with 6 additions and 0 deletions.
  1. +3 −0 src/core/geometry/qgsmultilinestring.cpp
  2. +3 −0 src/core/geometry/qgsmultipoint.cpp
@@ -128,7 +128,10 @@ bool QgsMultiLineString::addGeometry( QgsAbstractGeometry *g )
bool QgsMultiLineString::insertGeometry( QgsAbstractGeometry *g, int index )
{
if ( !g || QgsWkbTypes::flatType( g->wkbType() ) != QgsWkbTypes::LineString )
{
delete g;
return false;
}

return QgsGeometryCollection::insertGeometry( g, index );
}
@@ -142,7 +142,10 @@ bool QgsMultiPointV2::addGeometry( QgsAbstractGeometry *g )
bool QgsMultiPointV2::insertGeometry( QgsAbstractGeometry *g, int index )
{
if ( !g || QgsWkbTypes::flatType( g->wkbType() ) != QgsWkbTypes::Point )
{
delete g;
return false;
}

return QgsGeometryCollection::insertGeometry( g, index );
}

0 comments on commit b46d8d3

Please sign in to comment.
You can’t perform that action at this time.