[GRASS-dev] Possible memory leak in G__open_cell_old in opencell.c

Glynn Clements glynn at gclements.plus.com
Sun Mar 17 15:15:09 PDT 2013

matteo poletti wrote:

> I am debugging my code to find memory leak. I have a memory leak
> that I am not able to find. Is it possible that there is a memory
> leak in the function G__open_cell_old declared in opencell.c?
> It is the first time that I deal with the gis library code so please
> forgive me if I misunderstand the code.
> I do not understand why the variable gdal is not freed at the end of
> the function.

Because it's "owned" by the fileinfo structure; line 311:

	fcb->gdal = gdal;

The structure is freed on line 131 of closecell.c:

130	if (fcb->gdal)
131	    G_close_gdal_link(fcb->gdal);


Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list