[geos-devel] possible memory leak in InteriorPointArea

Peter Körner osm-lists at mazdermind.de
Wed Sep 7 12:09:37 EDT 2011


Am 07.09.2011 16:35, schrieb Sandro Santilli:
> On Tue, Sep 06, 2011 at 10:07:10PM +0200, Peter Körner wrote:
>> Hi guys!
>>
>> I guess I'm just using the InteriorPointArea wrong, but I get a
>> memory-leak reported in valgrind:
>>
> Build with debugging symbols on (-g option to GCC).

This gives me that:

==18925== 168 (48 direct, 120 indirect) bytes in 1 blocks are definitely 
lost in loss record 26 of 27
==18925==    at 0x4C28B42: operator new(unsigned long) 
(vg_replace_malloc.c:261)
==18925==    by 0x5BC9DF2: 
geos::geom::GeometryFactory::createLineString(geos::geom::CoordinateSequence*) 
const (GeometryFactory.cpp:535)
==18925==    by 0x5BB5402: 
geos::algorithm::InteriorPointArea::addPolygon(geos::geom::Geometry 
const*) (InteriorPointArea.cpp:91)
==18925==    by 0x408A51: ImportHandler::write_way() (in 
/home/peter/osm-history-renderer/importer/osm-history-importer)

Digging little deeper it seems that it just happens when I pass a 
invalid polygon into the InteriorPointArea class. It throws an
   TopologyException: found non-noded intersection between ...

and exists the function before the pointer is freed. This makes me 
think, if I'm supposed to do additional checks before I pass my polygon 
to the InteriorPointArea class.

Peter


More information about the geos-devel mailing list