[GRASS-SVN] r46965 - grass/branches/develbranch_6/vector/v.generalize

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 4 06:58:31 EDT 2011


Author: mmetz
Date: 2011-07-04 03:58:31 -0700 (Mon, 04 Jul 2011)
New Revision: 46965

Modified:
   grass/branches/develbranch_6/vector/v.generalize/misc.c
Log:
fix memory leak

Modified: grass/branches/develbranch_6/vector/v.generalize/misc.c
===================================================================
--- grass/branches/develbranch_6/vector/v.generalize/misc.c	2011-07-04 10:58:02 UTC (rev 46964)
+++ grass/branches/develbranch_6/vector/v.generalize/misc.c	2011-07-04 10:58:31 UTC (rev 46965)
@@ -286,6 +286,7 @@
 	/* Vect_line_intersection is quite slow, hopefully not so bad because only few 
 	 * intersections should be found if any */
 
+	AXLines = BXLines = NULL;
 	Vect_line_intersection(Points, BPoints, &AXLines, &BXLines,
 			       &naxlines, &nbxlines, 0);
 
@@ -298,14 +299,16 @@
 	    for (j = 0; j < naxlines; j++) {
 		Vect_destroy_line_struct(AXLines[j]);
 	    }
+	}
+	if (AXLines)
 	    G_free(AXLines);
-	}
 	if (nbxlines > 0) {
 	    for (j = 0; j < nbxlines; j++) {
 		Vect_destroy_line_struct(BXLines[j]);
 	    }
+	}
+	if (BXLines)
 	    G_free(BXLines);
-	}
 
 	if (naxlines > 1 || nbxlines > 1) {
 	    intersect = 1;



More information about the grass-commit mailing list