[GRASS-dev] Re: Fwd: [GRASS-SVN] r29640 - grass/trunk/lib/gis
Martin Landa
landa.martin at gmail.com
Fri Jan 11 17:18:37 EST 2008
Hi,
you are right, thanks for pointing it out...
Fixed in svn-trunk
http://trac.osgeo.org/grass/changeset/29672
Martin
2008/1/11, Glynn Clements <glynn at gclements.plus.com>:
>
> Markus Neteler wrote:
>
> > it appears that Martin has solved it. Still have to test.
>
> > Modified:
> > grass/trunk/lib/gis/get_ellipse.c
> > Log:
> > Fixing memory leak in G_get_ellipsoid_parameters(), ticket #14
>
> FWIW, I would consider moving the body of G_get_ellipsoid_parameters()
> into a separate function, leaving something like:
>
> G_get_ellipsoid_parameters (double *a, double *e2)
> {
> ...
> proj_keys = G_read_key_value_file(ipath, &in_stat);
> stat = get_ellipsoid_parameters(proj_keys, a, e2);
> G_free_key_value(proj_keys);
> return stat;
> }
>
> This eliminates the need to remember to free proj_keys at each return.
>
> Similar logic applies to handling files, i.e. using:
>
> fp = fopen(...);
> stat = process_the_file(fp, ...);
> fclose(fp);
> return stat;
>
> rather than having to remember to call fclose(fp) at many different
> "return" statements.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
--
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *
More information about the grass-dev
mailing list