[postgis-tickets] [PostGIS] #4429: PROJ6: lwgeom_transform_from_str leaks PJs

PostGIS trac at osgeo.org
Fri Jun 14 08:47:14 PDT 2019


#4429: PROJ6: lwgeom_transform_from_str leaks PJs
------------------------+---------------------------
 Reporter:  Algunenano  |      Owner:  Algunenano
     Type:  defect      |     Status:  assigned
 Priority:  high        |  Milestone:  PostGIS 3.0.0
Component:  postgis     |    Version:  trunk
 Keywords:              |
------------------------+---------------------------
 The current implementation of `lwgeom_transform_from_str` is leaking PJ
 and might leak pj_out on error:
 {{{
 int
 lwgeom_transform_from_str(LWGEOM *geom, const char* instr, const char*
 outstr)
 {
         PJ *pj = proj_create_crs_to_crs(NULL, instr, outstr, NULL);
         if (!pj)
         {
                 PJ *pj_in = proj_create(NULL, instr);
                 PJ *pj_out = proj_create(NULL, outstr);
                 if (!pj_in)
                 {
                         lwerror("could not parse proj string '%s'",
 instr);
 <<<<<<<<<<<<<< pj_out might be leaked
                 }
                 if (!pj_out)
                 {
                         proj_destroy(pj_in);
                         lwerror("could not parse proj string '%s'",
 outstr);
                 }
 <<<<<<<<<<<<<< pj_out is definetely leaked
                 return LW_FAILURE;
         }

         return lwgeom_transform(geom, pj);
 <<<<<<<<<<<<<<<<<<<< pj is leaked
 }
 }}}

 I'm planning to fix this as part of the process of reviewing the slowness
 issue with PROJ6, just making a note here.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4429>
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