[postgis-tickets] [SCM] PostGIS branch master updated. 3.2.0-360-g49ee0d46c

git at osgeo.org git at osgeo.org
Tue Jan 25 11:26:45 PST 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  49ee0d46c7f9bab151b050ffa23e8b9971cc20ef (commit)
      from  c22680adf6b4ac9be5203211d471c9d701b3fcf0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 49ee0d46c7f9bab151b050ffa23e8b9971cc20ef
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Jan 20 17:51:25 2022 -0800

    Test for empty before reading start point. Closes #5036

diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index 95f94f1fb..b5d022d1c 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -2117,7 +2117,7 @@ lwgeom_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
 int
 lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
 {
-	if ( ! lwgeom )
+	if ( ! lwgeom || lwgeom_is_empty(lwgeom) )
 		return LW_FAILURE;
 
 	switch( lwgeom->type )
diff --git a/postgis/lwgeom_ogc.c b/postgis/lwgeom_ogc.c
index 5830345c3..6ba0c1ac7 100644
--- a/postgis/lwgeom_ogc.c
+++ b/postgis/lwgeom_ogc.c
@@ -697,14 +697,13 @@ Datum LWGEOM_startpoint_linestring(PG_FUNCTION_ARGS)
 		PG_RETURN_NULL();
 	}
 
-	PG_FREE_IF_COPY(geom, 0);
-
 	lwpoint = (LWGEOM *)lwpoint_make(lwgeom->srid, lwgeom_has_z(lwgeom), lwgeom_has_m(lwgeom), &pt);
 	ret = geometry_serialize(lwpoint);
 
 	lwgeom_free(lwgeom);
 	lwgeom_free(lwpoint);
 
+	PG_FREE_IF_COPY(geom, 0);
 	PG_RETURN_POINTER(ret);
 }
 

-----------------------------------------------------------------------

Summary of changes:
 liblwgeom/lwgeom.c   | 2 +-
 postgis/lwgeom_ogc.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list