Skip to content

Commit 91d2e4f

Browse files
committed
Fix leak in QgsGeometry make valid
Also swap some GEOS methods to managed versions
1 parent c80d84e commit 91d2e4f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/geometry/qgsgeometrymakevalid.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ QgsAbstractGeometry* _qgis_lwgeom_make_valid( const QgsAbstractGeometry& lwgeom_
897897

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

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

929930
GEOSGeometry* geosout = LWGEOM_GEOS_makeValid( geosgeom, errorMessage );
930-
GEOSGeom_destroy( geosgeom );
931+
GEOSGeom_destroy_r( handle, geosgeom );
931932
if ( !geosout )
932933
return NULL;
933934

934935
QgsAbstractGeometry* lwgeom_out = QgsGeos::fromGeos( geosout );
936+
GEOSGeom_destroy_r( handle, geosout );
935937
if ( !lwgeom_out )
936938
return NULL;
937939

0 commit comments

Comments
 (0)