[GRASS-SVN] r63567 - grass/branches/develbranch_6/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 16 00:34:30 PST 2014


Author: mmetz
Date: 2014-12-16 00:34:30 -0800 (Tue, 16 Dec 2014)
New Revision: 63567

Modified:
   grass/branches/develbranch_6/lib/vector/Vlib/write_nat.c
Log:
Vlib: fix memory leak (backport r63512)

Modified: grass/branches/develbranch_6/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/write_nat.c	2014-12-16 08:31:57 UTC (rev 63566)
+++ grass/branches/develbranch_6/lib/vector/Vlib/write_nat.c	2014-12-16 08:34:30 UTC (rev 63567)
@@ -400,15 +400,17 @@
 			 struct line_pnts *points, struct line_cats *cats)
 {
     int old_type;
-    struct line_pnts *old_points;
-    struct line_cats *old_cats;
+    static struct line_pnts *old_points = NULL;
+    static struct line_cats *old_cats = NULL;
     long new_offset;
     
     /* TODO: enable points and cats == NULL  */
 
     /* First compare numbers of points and cats with tha old one */
-    old_points = Vect_new_line_struct();
-    old_cats = Vect_new_cats_struct();
+    if (!old_points) {
+	old_points = Vect_new_line_struct();
+	old_cats = Vect_new_cats_struct();
+    }
 
     old_type = V1_read_line_nat(Map, old_points, old_cats, offset);
     if (old_type == -1)



More information about the grass-commit mailing list