[GRASS-SVN] r52894 - grass/branches/releasebranch_6_4/vector/v.what

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


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

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

Modified: grass/branches/releasebranch_6_4/vector/v.what/what.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.what/what.c	2012-08-25 12:34:46 UTC (rev 52893)
+++ grass/branches/releasebranch_6_4/vector/v.what/what.c	2012-08-25 12:34:55 UTC (rev 52894)
@@ -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