[Gdal-dev] memory leaks in MITAB driver
Mateusz Loskot
mateusz at loskot.net
Mon Jul 9 15:28:00 EDT 2007
Richard Matsunaga wrote:
> I've fixed a few memory leaks in the MITAB driver that have been plaguing
> me lately. Hopefully someone more qualified than I can validate
> these changes and submit them into the code base.
>
> Index: /ogr/ogrsf_frmts/mitab/mitab_feature.cpp
> ===================================================================
> --- /ogr/ogrsf_frmts/mitab/mitab_feature.cpp (revision 11729)
> +++ /ogr/ogrsf_frmts/mitab/mitab_feature.cpp (working copy)
> @@ -7813,6 +7813,12 @@
> }
> }
>
> + if (poStyleMgr)
> + delete poStyleMgr;
> +
> + if (poStylePart)
> + delete poStylePart;
> +
Just a note, I'd suggest to remove if-clause.
There is no need to test for null pointer before calling delete operator.
So, I'd suggest to update the patch to read as:
delete poStyleMgr;
delete poStylePart;
and
CPLFree(styleString);
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the Gdal-dev
mailing list