[GRASS-SVN] r54931 - grass/trunk/lib/vector/rtree

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Feb 5 06:34:22 PST 2013


Author: mmetz
Date: 2013-02-05 06:34:22 -0800 (Tue, 05 Feb 2013)
New Revision: 54931

Modified:
   grass/trunk/lib/vector/rtree/index.c
   grass/trunk/lib/vector/rtree/rect.c
Log:
rtree: free all memory

Modified: grass/trunk/lib/vector/rtree/index.c
===================================================================
--- grass/trunk/lib/vector/rtree/index.c	2013-02-05 14:20:07 UTC (rev 54930)
+++ grass/trunk/lib/vector/rtree/index.c	2013-02-05 14:34:22 UTC (rev 54931)
@@ -226,6 +226,17 @@
     assert(t);
 
     if (t->fd > -1) {
+	int j, k;
+
+	for (i = 0; i < MAXLEVEL; i++) {
+	    for (j = 0; j < NODE_BUFFER_SIZE; j++) {
+		for (k = 0; k < MAXCARD; k++) {
+		    RTreeFreeBoundary(&t->nb[i][j].n.branch[k].rect);
+		}
+		free(t->nb[i][j].n.branch);
+	    }
+	}
+
 	if (t->free_nodes.alloc)
 	    free(t->free_nodes.pos);
 	free(t->nb[0]);

Modified: grass/trunk/lib/vector/rtree/rect.c
===================================================================
--- grass/trunk/lib/vector/rtree/rect.c	2013-02-05 14:20:07 UTC (rev 54930)
+++ grass/trunk/lib/vector/rtree/rect.c	2013-02-05 14:34:22 UTC (rev 54931)
@@ -101,7 +101,7 @@
 void RTreeFreeBoundary(struct RTree_Rect *r)
 {
     assert(r);
-    if(r->boundary)
+    if (r->boundary)
         free(r->boundary);
     r->boundary = NULL;
 }



More information about the grass-commit mailing list