From 79f2ca7d1b644a91e047aac04b8cdec8d71c333f Mon Sep 17 00:00:00 2001 From: David Blasby Date: Mon, 6 Oct 2003 18:09:08 +0000 Subject: [PATCH] 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 --- postgis_inout.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); -- 2.40.0