[GRASS-SVN] r52893 - grass/branches/develbranch_6/vector/v.what

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 25 05:34:47 PDT 2012


Author: mmetz
Date: 2012-08-25 05:34:46 -0700 (Sat, 25 Aug 2012)
New Revision: 52893

Modified:
   grass/branches/develbranch_6/vector/v.what/what.c
Log:
v.what: fix segfault when querying multiple maps

Modified: grass/branches/develbranch_6/vector/v.what/what.c
===================================================================
--- grass/branches/develbranch_6/vector/v.what/what.c	2012-08-25 12:34:31 UTC (rev 52892)
+++ grass/branches/develbranch_6/vector/v.what/what.c	2012-08-25 12:34:46 UTC (rev 52893)
@@ -20,11 +20,11 @@
     int type;
     char east_buf[40], north_buf[40];
     double sq_meters, sqm_to_sqft, acres, hectares, sq_miles;
-    double z = 0, l = 0;
+    double z, l;
     int notty = 0;
-    int getz = 0;
+    int getz;
     struct field_info *Fi;
-    plus_t line, area = 0, centroid;
+    plus_t line, area, centroid;
     int i;
     struct line_pnts *Points;
     struct line_cats *Cats;
@@ -43,8 +43,15 @@
 
 
     for (i = 0; i < nvects; i++) {
+	/* init variables */
+	area = 0;
+	getz = 0;
+	z = 0;
+	l = 0;
 
 	Vect_reset_cats(Cats);
+	Vect_reset_line(Points);
+
 	/* Try to find point first and only if no one was found try lines,
 	 *  otherwise point on line could not be selected and similarly for areas */
 	line =



More information about the grass-commit mailing list