[geos-devel] [GEOS] #747: BufferBuilder::bufferLineSingleSided leaks buffer geometry on exception

GEOS geos-trac at osgeo.org
Sun Oct 4 08:10:09 PDT 2015

#747: BufferBuilder::bufferLineSingleSided leaks buffer geometry on exception
 Reporter:  mloskot      |      Owner:  geos-devel@…
     Type:  defect       |     Status:  new
 Priority:  major        |  Milestone:  3.5.1
Component:  Default      |    Version:  svn-trunk
 Severity:  Significant  |   Keywords:
 In BufferBuilder::bufferLineSingleSided, there is this code

 Geometry* buf = 0;
     BufferBuilder tmp(modParams);
     buf = tmp.buffer( l, distance );
 ... //

 This code is followed by around 200 lines of complex logic.
 If any of the following steps throw exception, that buffer geometry leaks
 as unreachable.

 I was tempted to apply the simplest fix - wrap the whole
 bufferLineSingleSided  with try-catch and manually release all the
 internally allocated resources. But, I'm not sure as I may be missing
 something that actually allows to delete the memory there.

 Actually, this is the case in current
 [source:trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp at 3846#L278] where the
 memory leaks.

Ticket URL: <https://trac.osgeo.org/geos/ticket/747>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).

More information about the geos-devel mailing list