From: David Blasby Date: Mon, 6 Oct 2003 18:09:08 +0000 (+0000) Subject: Fixed typo in add_to_geometry(). With very poorly aligned sub-objects, it X-Git-Tag: pgis_0_8_0~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79f2ca7d1b644a91e047aac04b8cdec8d71c333f;p=postgis Fixed typo in add_to_geometry(). With very poorly aligned sub-objects, it wouldnt allocate enough memory. Fixed it so its pesimistic and will allocate enough memory. git-svn-id: http://svn.osgeo.org/postgis/trunk@307 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis_inout.c b/postgis_inout.c index 728f4f3ad..c7a160456 100644 --- a/postgis_inout.c +++ b/postgis_inout.c @@ -11,6 +11,11 @@ * ********************************************************************** * $Log$ + * Revision 1.28 2003/10/06 18:09:08 dblasby + * Fixed typo in add_to_geometry(). With very poorly aligned sub-objects, it + * wouldnt allocate enough memory. Fixed it so its pesimistic and will allocate + * enough memory. + * * Revision 1.27 2003/08/22 17:40:11 dblasby * fixed geometry_in('SRID={no ;}'). * @@ -3086,8 +3091,8 @@ GEOMETRY *add_to_geometry(GEOMETRY *geom,int sub_obj_size, char *sub_obj, int ty GEOMETRY *result; int32 *old_offsets, *new_offsets; - //all the offsets could cause re-alignment problems, so need to deal with each on - size = geom->size +(4*geom->nobjs +1) /*byte align*/ + //all the offsets could cause re-alignment problems, so need to deal with each one + size = geom->size +4*(geom->nobjs +1) /*byte align*/ +sub_obj_size + 4 /*ObjType[]*/ +4 /*new offset*/; result = (GEOMETRY *) palloc(size);