Skip to content
Permalink
Browse files

Fix leak in QgsGeometry make valid

Also swap some GEOS methods to managed versions
  • Loading branch information
nyalldawson committed Feb 7, 2017
1 parent c80d84e commit 91d2e4fa7b0f454087a2c9523f05b38c0b25491f
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/core/geometry/qgsgeometrymakevalid.cpp
@@ -897,6 +897,7 @@ QgsAbstractGeometry* _qgis_lwgeom_make_valid( const QgsAbstractGeometry& lwgeom_

// try to convert to GEOS, if impossible, clean that up first
// otherwise (adding only duplicates of existing points)
GEOSContextHandle_t handle = QgsGeos::getGEOSHandler();

GEOSGeometry* geosgeom = QgsGeos::asGeos( &lwgeom_in );
if ( ! geosgeom )
@@ -927,11 +928,12 @@ QgsAbstractGeometry* _qgis_lwgeom_make_valid( const QgsAbstractGeometry& lwgeom_
}

GEOSGeometry* geosout = LWGEOM_GEOS_makeValid( geosgeom, errorMessage );
GEOSGeom_destroy( geosgeom );
GEOSGeom_destroy_r( handle, geosgeom );
if ( !geosout )
return NULL;

QgsAbstractGeometry* lwgeom_out = QgsGeos::fromGeos( geosout );
GEOSGeom_destroy_r( handle, geosout );
if ( !lwgeom_out )
return NULL;

0 comments on commit 91d2e4f

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