[PostGIS] #5974: Add matching finishGEOS() to all initGEOS()

PostGIS trac at osgeo.org
Sun Aug 24 06:01:16 PDT 2025


#5974: Add matching finishGEOS() to all initGEOS()
-------------------------+---------------------------
 Reporter:  ezimanyi     |      Owner:  pramsey
     Type:  enhancement  |     Status:  new
 Priority:  medium       |  Milestone:  PostGIS 3.6.0
Component:  postgis      |    Version:  3.5.x
 Keywords:               |
-------------------------+---------------------------
 To avoid memory leaks when using GEOS without PostgreSQL, it is necessary
 to add matching finishGEOS() with all calls to initGEOS(). In the current
 source code of 3.6.0rc1 there are 5 occurrences of finishGEOS() in the
 directory cunit while there are 78 occurrences of initGEOS().

 The following PR
 https://github.com/MobilityDB/postgis/commit/923c304394755ea31392970aaf38ea1d4d934d86
 aims at ensuring that every time initGEOS() is called, a matching
 finishGEOS() is always performed, whether there is a potential error
 (i.e., in GEOS_FREE_AND_FAIL) or not (i.e., before the return of the
 function where initGEOS() was called).

 This PR is a first attempt toward this. Please notice that this was done
 blindly, without building PostGIS, just to see how the code would look
 like.
 The PR only modified the files in the directories liblwgeom and raster, it
 didn't modify the files in the postgis directory because this is not
 formally needed for PostgreSQL.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5974>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list