******************************************************************/
LWGEOM *lwcollection_getsubgeom(LWCOLLECTION *col, int gnum);
+
+/* WARNING: the output will contain references to geometries in the input, */
+/* so the result must be carefully released, not freed. */
LWCOLLECTION* lwcollection_extract(LWCOLLECTION *col, int type);
/**
* Takes a potentially heterogeneous collection and returns a homogeneous
* collection consisting only of the specified type.
+* WARNING: the output will contain references to geometries in the input,
+* so the result must be carefully released, not freed.
*/
LWCOLLECTION* lwcollection_extract(LWCOLLECTION *col, int type)
{
geomlist[geomlistlen] = tmpcol->geoms[j];
geomlistlen++;
}
+ if (tmpcol->geoms)
+ lwfree(tmpcol->geoms);
+ if (tmpcol->bbox)
+ lwfree(tmpcol->bbox);
lwfree(tmpcol);
}
}