// g++ postgis_GEOSwrapper.cpp -c -I/usr/local/include -I/usr/local/include/geos -I/usr/local/src/postgresql-7.2.3//src/include
+/*
+* $Log$
+* Revision 1.10 2003/10/20 19:50:49 strk
+* Removed some memory leaks in PostGIS2* converters.
+*
+*/
+
#include <stdio.h>
Geometry *g;
Envelope *envelope = new Envelope(box->LLB.x,box->URT.x ,box->LLB.y,box->URT.y);
g = geomFactory->toGeometry(envelope,geomFactory->getPrecisionModel(), SRID);
+ delete envelope;
if (g==NULL)
return NULL;
g->setSRID(SRID);
- delete envelope;
return g;
}
catch (GEOSException *ge)
subGeos->push_back(geoms[t]);
}
g = geomFactory->buildGeometry(subGeos);
+ delete subGeos;
if (g==NULL)
return NULL;
g->setSRID(SRID);
else
c = new Coordinate(point->x, point->y, point->z);
Geometry *g = geomFactory->createPoint(*c);
+ delete c;
if (g==NULL)
return NULL;
g->setSRID(SRID);
}
Geometry *g = geomFactory->createLineString(coords);
+ delete coords;
if (g==NULL)
return NULL;
g->setSRID(SRID);
subPolys->push_back(PostGIS2GEOS_polygon(polygons[t], SRID,is3d ));
}
g = geomFactory->createMultiPolygon(subPolys);
- if (subPolys != NULL)
- {
-
- delete subPolys;
- }
+ delete subPolys;
if (g== NULL)
return NULL;
subLines->push_back(PostGIS2GEOS_linestring(lines[t], SRID,is3d ));
}
g = geomFactory->createMultiLineString(subLines);
+ delete subLines;
if (g==NULL)
return NULL;
g->setSRID(SRID);
subPoints->push_back(PostGIS2GEOS_point(points[t], SRID,is3d ));
}
g = geomFactory->createMultiPoint(subPoints);
+ delete subPoints;
if (g==NULL)
return NULL;
g->setSRID(SRID);
}
}
outerRing = (LinearRing*) geomFactory->createLinearRing(cl);
+ delete cl;
if (outerRing == NULL)
return NULL;
outerRing->setSRID(SRID);
}
}
innerRing = (LinearRing *) geomFactory->createLinearRing(cl);
+ delete cl;
if (innerRing == NULL)
+ {
+ delete outerRing;
return NULL;
+ }
innerRing->setSRID(SRID);
innerRings->push_back(innerRing);
pointOffset += polygon->npoints[ring];
return NULL;
g->setSRID(SRID);
return g;
- }
+ }
catch (GEOSException *ge)
{
NOTICE_MESSAGE((char *)ge->toString().c_str());