[GRASS-SVN] r69751 - grass/trunk/lib/raster

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 28 13:55:24 PDT 2016


Author: mmetz
Date: 2016-10-28 13:55:24 -0700 (Fri, 28 Oct 2016)
New Revision: 69751

Modified:
   grass/trunk/lib/raster/close.c
   grass/trunk/lib/raster/open.c
Log:
rasterlib: fix memory leak for compressed null files

Modified: grass/trunk/lib/raster/close.c
===================================================================
--- grass/trunk/lib/raster/close.c	2016-10-28 19:04:25 UTC (rev 69750)
+++ grass/trunk/lib/raster/close.c	2016-10-28 20:55:24 UTC (rev 69751)
@@ -155,6 +155,8 @@
 
     if (fcb->null_bits)
 	G_free(fcb->null_bits);
+    if (fcb->null_row_ptr)
+	G_free(fcb->null_row_ptr);
     if (fcb->null_fd >= 0)
 	close(fcb->null_fd);
     fcb->null_fd = -1;
@@ -478,6 +480,9 @@
 
     G_free(fcb->null_bits);
 
+    if (fcb->null_row_ptr)
+	G_free(fcb->null_row_ptr);
+
     if (fcb->map_type != CELL_TYPE)
 	Rast_quant_free(&fcb->quant);
 

Modified: grass/trunk/lib/raster/open.c
===================================================================
--- grass/trunk/lib/raster/open.c	2016-10-28 19:04:25 UTC (rev 69750)
+++ grass/trunk/lib/raster/open.c	2016-10-28 20:55:24 UTC (rev 69751)
@@ -708,6 +708,7 @@
 
     fcb->null_temp_name = tempname;
 
+    fcb->null_row_ptr = NULL;
     if (R__.compress_nulls) {
 	fcb->null_row_ptr = G_calloc(fcb->cellhd.rows + 1, sizeof(off_t));
 	G_zero(fcb->row_ptr, (fcb->cellhd.rows + 1) * sizeof(off_t));



More information about the grass-commit mailing list