[geos-devel] possible memory leak in InteriorPointArea

Sandro Santilli strk at keybit.net
Wed Sep 7 12:19:27 EDT 2011


On Wed, Sep 07, 2011 at 06:09:37PM +0200, Peter Körner wrote:
> 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.

Well, if the object is created by the InteriorPointArea class it
should be deleted by it before throwing, so it _is_ a bug.
Could you please file a ticket for this ?
Best if with a very small example of an invalid polygon...

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the geos-devel mailing list