[GRASS-SVN] r46964 - grass/branches/develbranch_6/vector/v.clean

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


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

Modified:
   grass/branches/develbranch_6/vector/v.clean/prune.c
Log:
fix memory leak

Modified: grass/branches/develbranch_6/vector/v.clean/prune.c
===================================================================
--- grass/branches/develbranch_6/vector/v.clean/prune.c	2011-07-04 10:56:43 UTC (rev 46963)
+++ grass/branches/develbranch_6/vector/v.clean/prune.c	2011-07-04 10:58:02 UTC (rev 46964)
@@ -133,6 +133,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(TPoints, BPoints, &AXLines, &BXLines,
 				       &naxlines, &nbxlines, 0);
 
@@ -145,14 +146,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