]> granicus.if.org Git - postgis/commitdiff
allocation for deserialized lwline made after type checking
authorSandro Santilli <strk@keybit.net>
Tue, 21 Dec 2004 11:25:10 +0000 (11:25 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 21 Dec 2004 11:25:10 +0000 (11:25 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1170 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwline.c

index f0ce27836671a14590f83612f8ba20298cb6b343..3227da6a49b86166fa333130fd0aced915a0ddc2 100644 (file)
@@ -42,10 +42,7 @@ lwline_deserialize(char *serialized_form)
        uint32 npoints;
        POINTARRAY *pa;
 
-       result = (LWLINE*) lwalloc(sizeof(LWLINE)) ;
-
        type = (unsigned char) serialized_form[0];
-       result->type = type;
 
        if ( lwgeom_getType(type) != LINETYPE)
        {
@@ -53,6 +50,9 @@ lwline_deserialize(char *serialized_form)
                return NULL;
        }
 
+       result = (LWLINE*) lwalloc(sizeof(LWLINE)) ;
+       result->type = type;
+
        loc = serialized_form+1;
 
        if (lwgeom_hasBBOX(type))