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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 31 16:40:04 PDT 2013


Author: huhabla
Date: 2013-07-31 16:40:04 -0700 (Wed, 31 Jul 2013)
New Revision: 57335

Modified:
   grass/trunk/lib/raster/range.c
Log:
Bugfix, the open range file descriptor must be closed in case the cell range file exists but its empty.


Modified: grass/trunk/lib/raster/range.c
===================================================================
--- grass/trunk/lib/raster/range.c	2013-07-31 23:26:22 UTC (rev 57334)
+++ grass/trunk/lib/raster/range.c	2013-07-31 23:40:04 UTC (rev 57335)
@@ -209,8 +209,11 @@
 	}
 
 	/* if range file exists but empty */
-	if (!fgets(buf, sizeof buf, fd))
+        if (!fgets(buf, sizeof buf, fd)) {
+            if (fd)
+                fclose(fd);
 	    return 2;
+        }
 
 	x[0] = x[1] = x[2] = x[3] = 0;
 	count = sscanf(buf, "%d%d%d%d", &x[0], &x[1], &x[2], &x[3]);



More information about the grass-commit mailing list