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

matteo poletti pollo1_91 at yahoo.it
Mon Mar 18 01:51:11 PDT 2013


> Da: Glynn Clements <glynn at gclements.plus.com>

>>  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?
>
> 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);
> 
> http://grass.osgeo.org/programming6/closecell_8c_source.html#l00130
> 

Thanks for your answer!

I found the problem: since I had a file the descriptor I closed it with the function close.
I didn't know that I need to call the function G_close_cell instead to deallocate the structures related to the file descriptor.

Thanks,
Matteo



More information about the grass-dev mailing list