[geos-devel] GEOS cross-heap problems

Frank Warmerdam warmerdam at pobox.com
Tue May 12 16:47:13 EDT 2009

Frank Warmerdam wrote:
> Folks,
> I had a serious problem reported by a client of mine. The issue turned out
> to be that the OSGeo4W GEOS package was built with a different version of
> visual studio than the OSGeo4W GDAL package.  The GDAL package calls:
>     pabyBuf = GEOSGeomToWKB_buf( geosGeom, &nSize );
>     ...
>     free( pabyBuf );
> The problem is that the buffer allocated by GEOS c-runtime is being freed
> with the free() of the GDAL c-runtime resulting in heap corruption.
> For things like geometry and coordinate sequences we have special
> deallocators available as part of the GEOS C API.  However this is not
> the case (as far as I know) for plain malloc()/free() type stuff.
> So my questions are:
>  1) Am I missing an existing GEOSFree() function?


Howard has pointed out that this is already a known issue, listed in:


I see Paul has "accepted" the ticket, but I don't see any sign that it
has been incorporated.  Also, what constraints do we have on backporting
an API *addition* like this?

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the geos-devel mailing list