[Gdal-dev] Memory leak in GeoTIFF driver

Frank Warmerdam fwarmerdam at gmail.com
Tue Jan 4 11:13:59 EST 2005


On Tue, 4 Jan 2005 15:04:04 +0100, Eric Dönges
<Eric.Doenges at rcs.ei.tum.de> wrote:
> Hi,
> 
> I've found a memory leak in the GeoTIFF driver in the
> GTiffDataset::SetGCPs member
> function - any GCPs already defined when SetGCPs is called are not
> freed; neither is
> the pointer to the projection string. Both are simply overwritten with
> the new values.
> The attached patch should correct both problems.

Eric,

You are quite right.  I have applied a variation on your
patch. 
 
> On a related note, is there any reason why the GeoTIFF driver will only
> load GCPs if
> there are more than 6 GCPs defined in the file ? I think the driver
> should simply
> load whatever is available, and let the application worry about wether
> there are
> enough points to do anything useful with.

There need to be six values in the tiepoints array for each GCP.
They are the x/y/z raster location and the x/y/z world location.
So the number of GCPs is the number of values in the tiepoints
list divided by six. 

PS. I also added a test in my testsuite for TIFF GCPs.  

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 Gdal-dev mailing list