Changeset: 01fee991bfa7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/01fee991bfa7
Modified Files:
        geom/monetdb5/geom.c
Branch: geo-update
Log Message:

Fixes mem leak from the implementation of ST_Collect


diffs (30 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -1480,17 +1480,15 @@ wkbCollectAggr (wkb **out, const bat *bi
        if (*out == NULL)
                msg = createException(MAL, "geom.ConvexHull", SQLSTATE(38000) 
"Geos operation geos2wkb failed");
 
-       //Frees
-       bat_iterator_end(&bi);
-       if (unionGroup) {
-               for (BUN i = 0; i < count; i++)
-                       if (unionGroup[i])
-                               GEOSGeom_destroy(unionGroup[i]);
-               GDKfree(unionGroup);
-       }
-       //TODO This free is causing issues, is it not necessary?
-       //GEOSGeom_destroy(collection);
-       BBPunfix(b->batCacheid);
+    // Cleanup
+    // Data ownership has been transfered from unionGroup elements to 
+    // collection. Check libgeos GEOSGeom_createCollection() for more.
+    bat_iterator_end(&bi);
+    GEOSGeom_destroy(collection);
+    if (unionGroup)
+        GDKfree(unionGroup);
+    BBPunfix(b->batCacheid);
+
        return msg;
 }
 
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to