[GRASS-SVN] r57282 - grass/trunk/raster/r.to.vect

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 26 06:39:49 PDT 2013


Author: mmetz
Date: 2013-07-26 06:39:48 -0700 (Fri, 26 Jul 2013)
New Revision: 57282

Modified:
   grass/trunk/raster/r.to.vect/lines_io.c
Log:
r.to.vect: fix another memory leak

Modified: grass/trunk/raster/r.to.vect/lines_io.c
===================================================================
--- grass/trunk/raster/r.to.vect/lines_io.c	2013-07-26 13:36:03 UTC (rev 57281)
+++ grass/trunk/raster/r.to.vect/lines_io.c	2013-07-26 13:39:48 UTC (rev 57282)
@@ -99,12 +99,16 @@
 static int write_ln(struct COOR *begin, struct COOR *end,	/* start and end point of line */
 		    int n)
 {				/* number of points to write */
-    struct line_pnts *points = Vect_new_line_struct();
+    static struct line_pnts *points = NULL;
     double x, y;
     struct COOR *p, *last;
     int i, cat, field;
     static int count = 1;
 
+    if (!points)
+	points = Vect_new_line_struct();
+    Vect_reset_line(points);
+
     field = 1;
     ++n;
 



More information about the grass-commit mailing list