Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#747 closed defect (fixed)

BufferBuilder::bufferLineSingleSided leaks buffer geometry on exception

Reported by: mloskot Owned by: geos-devel@…
Priority: major Milestone: 3.5.1
Component: Default Version: main
Severity: Significant Keywords:
Cc:

Description

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 trunk/tests/unit/capi/GEOSOffsetCurveTest.cpp@3846#L278 where the memory leaks.

Change History (5)

comment:1 by strk, 9 years ago

Resolution: fixed
Status: newclosed

Should be better as of r4101 (3.5 branch for 3.5.1) and r4103 in trunk (for 3.6.0)

comment:2 by mloskot, 9 years ago

@strk I forgot the auto_ptr is kosher. Great, it fixes the issues. Thanks!

comment:3 by Sandro Santilli <strk@…>, 7 years ago

In 3ab01dc/git:

Fix a few potential (one confirmed) leak in single sided buffer

See #747

git-svn-id: http://svn.osgeo.org/geos/trunk@4103 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:4 by Sandro Santilli <strk@…>, 7 years ago

In 3ab01dc/git:

Fix a few potential (one confirmed) leak in single sided buffer

See #747

git-svn-id: http://svn.osgeo.org/geos/trunk@4103 5242fede-7e19-0410-aef8-94bd7d2200fb

comment:5 by Sandro Santilli <strk@…>, 7 years ago

In 3ab01dc/git:

Fix a few potential (one confirmed) leak in single sided buffer

See #747

git-svn-id: http://svn.osgeo.org/geos/trunk@4103 5242fede-7e19-0410-aef8-94bd7d2200fb

Note: See TracTickets for help on using tickets.