]> granicus.if.org Git - postgis/commitdiff
Fix a bug in tgeom_free, related to #665
authorOlivier Courtin <olivier.courtin@camptocamp.com>
Mon, 6 Feb 2012 21:15:33 +0000 (21:15 +0000)
committerOlivier Courtin <olivier.courtin@camptocamp.com>
Mon, 6 Feb 2012 21:15:33 +0000 (21:15 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9053 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/cunit/cu_surface.c
liblwgeom/libtgeom.c

index 614751cb3010d0fe778707911f8fa797affa6d15..abc196f857291f9cbb6b55403cf86dcdaa58cd45 100644 (file)
@@ -284,7 +284,6 @@ check_tgeom(char *ewkt, int type, uint32_t srid, int is_solid)
        CU_ASSERT(lwgeom_same(g1, g2));
        lwgeom_free(g2);
 
-#if 0
        tser = tgeom_serialize(tgeom);
        tgeom2 = tgeom_deserialize(tser);
        g2 = lwgeom_from_tgeom(tgeom2);
@@ -307,8 +306,6 @@ check_tgeom(char *ewkt, int type, uint32_t srid, int is_solid)
        lwfree(tser);
        tgeom_free(tgeom2);
        lwgeom_free(g2);
-#endif
-
        tgeom_free(tgeom);
        lwgeom_free(g1);
 }
@@ -515,6 +512,7 @@ psurface_tgeom(void)
        check_tgeom("POLYHEDRALSURFACE(((0 1 2 3,4 5 6 7,8 9 10 11,0 1 2 3),(12 13 14 15,16 17 18 19,20 21 22 23,12 13 14 15),(16 17 18 19,20 21 22 23,24 25 26 27,16 17 18 19)))", POLYHEDRALSURFACETYPE, 0, 0);
 #endif
 
+
 }
 
 
index af9417b6602449102475bc793d99499b9a6b3146..574b503c6d092f26f23d3d93010e4ecaf90fdb53 100644 (file)
@@ -379,7 +379,7 @@ tgeom_free(TGEOM *tgeom)
                /* rings */
                for (j=0 ; j < tgeom->faces[i]->nrings ; j++)
                        ptarray_free(tgeom->faces[i]->rings[j]);
-               if (tgeom->faces[i]->rings)
+               if (tgeom->faces[i]->nrings)
                        lwfree(tgeom->faces[i]->rings);
 
                lwfree(tgeom->faces[i]);
@@ -599,8 +599,8 @@ tgeom_serialize_size(const TGEOM *tgeom)
        int dims = FLAGS_NDIMS(tgeom->flags);
 
        size = sizeof(uint8_t);                                 /* type */
-       size += sizeof(uint8_t);                                        /* flags */
-       size += sizeof(uint32_t);                                       /* srid */
+       size += sizeof(uint8_t);                                /* flags */
+       size += sizeof(uint32_t);                               /* srid */
        if (tgeom->bbox) size += sizeof(BOX3D);                 /* bbox */
 
        size += sizeof(int);                                    /* nedges */
@@ -752,7 +752,6 @@ tgeom_serialize(const TGEOM *tgeom)
        size_t size, retsize;
        TSERIALIZED * t;
        uint8_t *data;
-
        size = tgeom_serialize_size(tgeom);
        data = lwalloc(size);
        tgeom_serialize_buf(tgeom, data, &retsize);
@@ -778,6 +777,7 @@ tgeom_serialize(const TGEOM *tgeom)
 }
 
 
+
 /*
  * Deserialize a TSERIALIZED struct and
  * return a TGEOM pointer