#747 closed defect (fixed)
BufferBuilder::bufferLineSingleSided leaks buffer geometry on exception
Reported by: | mloskot | Owned by: | |
---|---|---|---|
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 , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
@strk I forgot the auto_ptr is kosher. Great, it fixes the issues. Thanks!
Should be better as of r4101 (3.5 branch for 3.5.1) and r4103 in trunk (for 3.6.0)