[GRASS-SVN] r62255 - grass/trunk/raster3d/r3.flow

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 14 17:28:17 PDT 2014


Author: annakrat
Date: 2014-10-14 17:28:17 -0700 (Tue, 14 Oct 2014)
New Revision: 62255

Modified:
   grass/trunk/raster3d/r3.flow/flowline.c
   grass/trunk/raster3d/r3.flow/voxel_traversal.c
   grass/trunk/raster3d/r3.flow/voxel_traversal.h
Log:
r3.flow: fix pointers freeing

Modified: grass/trunk/raster3d/r3.flow/flowline.c
===================================================================
--- grass/trunk/raster3d/r3.flow/flowline.c	2014-10-14 21:12:43 UTC (rev 62254)
+++ grass/trunk/raster3d/r3.flow/flowline.c	2014-10-15 00:28:17 UTC (rev 62255)
@@ -182,7 +182,7 @@
 		    /* if not run for the 1. time and previous and next point coordinates
 		       differ by more than 1 voxel coordinate */
 		    if (coor_diff > 1) {
-			traverse(region, point, new_point, trav_coords, &size,
+			traverse(region, point, new_point, &trav_coords, &size,
 				 &trav_count);
 			for (j = 0; j < trav_count; j++) {
 			    value =

Modified: grass/trunk/raster3d/r3.flow/voxel_traversal.c
===================================================================
--- grass/trunk/raster3d/r3.flow/voxel_traversal.c	2014-10-14 21:12:43 UTC (rev 62254)
+++ grass/trunk/raster3d/r3.flow/voxel_traversal.c	2014-10-15 00:28:17 UTC (rev 62255)
@@ -4,7 +4,7 @@
 #include "voxel_traversal.h"
 
 void traverse(RASTER3D_Region * region, double *start, double *end,
-	      int *coordinates, int *size, int *coor_count)
+	      int **coordinates, int *size, int *coor_count)
 {
     double dx, dy, dz;
     int step_x, step_y, step_z;
@@ -81,15 +81,15 @@
 
 	    break;
 
-	coordinates[count * 3 + 0] = x;
-	coordinates[count * 3 + 1] = region->rows - y - 1;
-	coordinates[count * 3 + 2] = z;
+	(*coordinates)[count * 3 + 0] = x;
+	(*coordinates)[count * 3 + 1] = region->rows - y - 1;
+	(*coordinates)[count * 3 + 2] = z;
 	count++;
 
 	/* reallocation for cases when the steps would be too big */
 	if (*size <= count) {
 	    *size = 2 * (*size);
-	    coordinates = G_realloc(coordinates, (*size) * 3 * sizeof(int));
+	    *coordinates = G_realloc(*coordinates, (*size) * 3 * sizeof(int));
 	}
     }
     *coor_count = count;

Modified: grass/trunk/raster3d/r3.flow/voxel_traversal.h
===================================================================
--- grass/trunk/raster3d/r3.flow/voxel_traversal.h	2014-10-14 21:12:43 UTC (rev 62254)
+++ grass/trunk/raster3d/r3.flow/voxel_traversal.h	2014-10-15 00:28:17 UTC (rev 62255)
@@ -4,6 +4,6 @@
 #include <grass/raster3d.h>
 
 void traverse(RASTER3D_Region *region, double *start, double *end,
-              int *coordinates, int *size, int *coor_count);
+              int **coordinates, int *size, int *coor_count);
 
 #endif // VOXEL_TRAVERSAL_H



More information about the grass-commit mailing list