瀏覽代碼

r.to.vect: fix another memory leak

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57282 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 11 年之前
父節點
當前提交
611b93757d
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      raster/r.to.vect/lines_io.c

+ 5 - 1
raster/r.to.vect/lines_io.c

@@ -99,12 +99,16 @@ int write_line(struct COOR *seed)
 static int write_ln(struct COOR *begin, struct COOR *end,	/* start and end point of line */
 static int write_ln(struct COOR *begin, struct COOR *end,	/* start and end point of line */
 		    int n)
 		    int n)
 {				/* number of points to write */
 {				/* number of points to write */
-    struct line_pnts *points = Vect_new_line_struct();
+    static struct line_pnts *points = NULL;
     double x, y;
     double x, y;
     struct COOR *p, *last;
     struct COOR *p, *last;
     int i, cat, field;
     int i, cat, field;
     static int count = 1;
     static int count = 1;
 
 
+    if (!points)
+	points = Vect_new_line_struct();
+    Vect_reset_line(points);
+
     field = 1;
     field = 1;
     ++n;
     ++n;