Fixed destructive memory release in LWGEOM_translate()

git-svn-id: http://svn.osgeo.org/postgis/trunk@1531 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2005-03-11 17:47:58 +00:00
parent 40fb8da773
commit eed544f659

View file

@ -1468,6 +1468,7 @@ PG_FUNCTION_INFO_V1(LWGEOM_translate);
Datum LWGEOM_translate(PG_FUNCTION_ARGS)
{
PG_LWGEOM *geom = (PG_LWGEOM *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
PG_LWGEOM *ret;
uchar *srl = SERIALIZED_FORM(geom);
BOX2DFLOAT4 box;
int hasbbox;
@ -1489,11 +1490,12 @@ Datum LWGEOM_translate(PG_FUNCTION_ARGS)
}
// Construct PG_LWGEOM
geom = PG_LWGEOM_construct(srl, lwgeom_getsrid(srl), hasbbox);
ret = PG_LWGEOM_construct(srl, lwgeom_getsrid(srl), hasbbox);
PG_FREE_IF_COPY(geom, 0);
// Release copy of detoasted input.
pfree(geom);
PG_RETURN_POINTER(geom);
PG_RETURN_POINTER(ret);
}
PG_FUNCTION_INFO_V1(LWGEOM_inside_circle_point);