[GRASS-SVN] r46921 - grass/trunk/raster/r.colors
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 1 13:38:34 EDT 2011
Author: huhabla
Date: 2011-07-01 10:38:34 -0700 (Fri, 01 Jul 2011)
New Revision: 46921
Modified:
grass/trunk/raster/r.colors/stats.c
Log:
Fixed segfault caused by incorrect free of not allocated raster
buffer
Modified: grass/trunk/raster/r.colors/stats.c
===================================================================
--- grass/trunk/raster/r.colors/stats.c 2011-07-01 17:21:51 UTC (rev 46920)
+++ grass/trunk/raster/r.colors/stats.c 2011-07-01 17:38:34 UTC (rev 46921)
@@ -50,7 +50,7 @@
void get_fp_stats(const char *name, const char *mapset,
struct FP_stats *statf,
DCELL min, DCELL max, int geometric, int geom_abs, int type) {
- DCELL *dcell;
+ DCELL *dcell = NULL;
int row, col, depth, nrows, ncols, ndepths = 1;
int fd;
G3D_Map *map3d = NULL;
@@ -147,10 +147,11 @@
G_percent(row, nrows, 2);
- if (type == RASTER_TYPE)
+ if (type == RASTER_TYPE) {
Rast_close(fd);
- else
+ if(dcell)
+ G_free(dcell);
+ } else {
G3d_closeCell(map3d);
-
- G_free(dcell);
+ }
}
More information about the grass-commit
mailing list