[GRASS-SVN] r46966 - grass/branches/releasebranch_6_4/vector/v.clean

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 4 07:06:27 EDT 2011


Author: mmetz
Date: 2011-07-04 04:06:27 -0700 (Mon, 04 Jul 2011)
New Revision: 46966

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

Modified: grass/branches/releasebranch_6_4/vector/v.clean/prune.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.clean/prune.c	2011-07-04 10:58:31 UTC (rev 46965)
+++ grass/branches/releasebranch_6_4/vector/v.clean/prune.c	2011-07-04 11:06:27 UTC (rev 46966)
@@ -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