[Gdal-dev] Memory leak fixes in ogrfeaturesytle.cpp

Frank Warmerdam warmerdam at pobox.com
Mon Sep 29 11:12:19 EDT 2003

Steve Brooks wrote:
> Frank,
>   I ran across several memory leaks in ogrfeaturestyle.cpp
> with a large input file and querying the feature style string I was
> getting several thousand memory leaks.
> The problem was in two places, first in CreateStyleToolFromStyleString
> it was not calling CSLDestroy(papszToken);
> Then in the destructors of OGRStyleTool subclasses they were
> only calling CPLFree(m_pasStyleValue);
> The problem with this is m_pasStyleValue is a vector like class of
> several OGRStyleValue's.  Inside OGRStyleValue can be a pointer to a
> heap allocated string in pszValue, which was the leak.
> Below are the changes that fixed these leaks.


Both sets of leaks fixed in CVS as per your suggestions.


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