[Gdal-dev] importFromWkt() problem

Frank Warmerdam warmerdam at pobox.com
Sat Sep 2 13:01:32 EDT 2006


Petteri Packalen wrote:
> WKT_BUF 1000000
> char * geo_trans = new char[ WKT_BUF ];

...
> The code is too length and fragmentd to be pasted here as a whole. The 
> latter approch creates correct output. However, now I noticed that there 
> may have some memory de-allocation problem with it which lead to another 
> question. Because I use SetGeometryDirectly( new_geom ), I don't release 
> new_geom explicitly. I have understood OGRFeature::DestroyFeature( 
> poDstFeature ) de-allocates it and all other resources it uses. Have I 
> understood it correctly?

Petteri,

Yes, that is correct.  You should not need to do anything to deallocate
the geometry after using SetGeometryDirectly().

How do you deallocate geo_trans though?  You can't use delete on the
geo_trans pointer after passing it to ImportFromWkt() since the pointer
is changed by that function.  I suspect this is your problem.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list