Some initializations and a null pointer avoidance test (#273)
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Nov 2009 04:55:28 +0000 (04:55 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Nov 2009 04:55:28 +0000 (04:55 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@4749 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_in_gml.c

index 8e4b195e233ed67d5cf46a544eb71186081602bc..1608ed6bff7129481c6d04876b14a83b87600703 100644 (file)
@@ -831,9 +831,9 @@ static POINTARRAY* parse_gml_poslist(xmlNodePtr xnode, bool *hasz)
  */
 static POINTARRAY* parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
 {
-       POINTARRAY *pa, *tmp_pa;
+       POINTARRAY *pa = 0, *tmp_pa = 0;
        xmlNodePtr xa, xb;
-       gmlSrs *srs;
+       gmlSrs *srs = 0;
        bool found;
 
        pa = NULL;
@@ -842,6 +842,7 @@ static POINTARRAY* parse_gml_data(xmlNodePtr xnode, bool *hasz, int *root_srid)
 
                if (xa->type != XML_ELEMENT_NODE) continue;
                if (!is_gml_namespace(xa, false)) continue;
+               if (!xa->name) continue;
 
                if (!strcmp((char *) xa->name, "pos")) {
                        tmp_pa = parse_gml_pos(xa, hasz);
@@ -967,13 +968,13 @@ static LWGEOM* parse_gml_line(xmlNodePtr xnode, bool *hasz, int *root_srid)
  */
 static LWGEOM* parse_gml_curve(xmlNodePtr xnode, bool *hasz, int *root_srid)
 {
-       xmlChar *interpolation;
+       xmlChar *interpolation = 0;
        int lss, last, i;
-       POINTARRAY **ppa;
-       POINTARRAY *pa;
+       POINTARRAY **ppa = 0;
+       POINTARRAY *pa = 0;
        xmlNodePtr xa;
-       LWGEOM *geom;
-       gmlSrs *srs;
+       LWGEOM *geom = 0;
+       gmlSrs *srs = 0;
        bool found=false;
        unsigned int npoints=0;