[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0alpha2-51-ge6c9403

git at osgeo.org git at osgeo.org
Thu Aug 13 13:13:16 PDT 2020


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  e6c9403689953350cc0bec69086fd49ee194f43f (commit)
      from  d1735b10d59ffedff43b939f4e7e7fafd1138259 (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 e6c9403689953350cc0bec69086fd49ee194f43f
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu Aug 13 13:13:11 2020 -0700

    Remove more memory leaks from tests

diff --git a/liblwgeom/cunit/cu_split.c b/liblwgeom/cunit/cu_split.c
index 714ea75..b7bcb1e 100644
--- a/liblwgeom/cunit/cu_split.c
+++ b/liblwgeom/cunit/cu_split.c
@@ -129,17 +129,21 @@ static void test_lwgeom_split(void)
 	geom = lwgeom_from_wkt("SRID=1;POLYGON((0 1, 10 1, 10 10, 0 10, 0 1))", LW_PARSER_CHECK_NONE);
 	CU_ASSERT(geom != NULL);
 	blade = lwgeom_from_wkt("LINESTRING(7 0,7 20)", LW_PARSER_CHECK_NONE);
-	ret = lwgeom_normalize(lwgeom_split(geom, blade));
+	tmp1 = lwgeom_split(geom, blade);
+	ret = lwgeom_normalize(tmp1);
+	lwgeom_free(tmp1);
 	CU_ASSERT(ret != NULL);
 	wkt = lwgeom_to_ewkt(ret);
-	tmp1 = lwgeom_normalize(lwgeom_from_wkt(
+	tmp1 = lwgeom_from_wkt(
 	    "SRID=1;GEOMETRYCOLLECTION(POLYGON((7 1,0 1,0 10,7 10,7 1)),POLYGON((7 10,10 10,10 1,7 1,7 10)))",
-	    LW_PARSER_CHECK_NONE));
-	in_wkt = lwgeom_to_ewkt(tmp1);
+	    LW_PARSER_CHECK_NONE);
+	tmp2 = lwgeom_normalize(tmp1);
+	in_wkt = lwgeom_to_ewkt(tmp2);
 	ASSERT_STRING_EQUAL(wkt, in_wkt);
 	lwfree(wkt);
 	lwfree(in_wkt);
 	lwgeom_free(tmp1);
+	lwgeom_free(tmp2);
 	lwgeom_free(ret);
 	lwgeom_free(geom);
 	lwgeom_free(blade);
diff --git a/liblwgeom/cunit/cu_wrapx.c b/liblwgeom/cunit/cu_wrapx.c
index d3e3a37..a5ca09a 100644
--- a/liblwgeom/cunit/cu_wrapx.c
+++ b/liblwgeom/cunit/cu_wrapx.c
@@ -19,7 +19,7 @@
 
 static void test_lwgeom_wrapx(void)
 {
-	LWGEOM *geom, *ret;
+	LWGEOM *geom, *ret, *tmp, *tmp2;
 	char *exp_wkt, *obt_wkt;
 
 	geom = lwgeom_from_wkt(
@@ -78,13 +78,18 @@ static void test_lwgeom_wrapx(void)
 		"LINESTRING(0 0,10 0)",
 		LW_PARSER_CHECK_NONE);
 	CU_ASSERT_FATAL(geom != NULL);
-	ret = lwgeom_normalize(lwgeom_wrapx(geom, 8, -10));
+	tmp = lwgeom_wrapx(geom, 8, -10);
+	ret = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
 	CU_ASSERT_FATAL(ret != NULL);
 	obt_wkt = lwgeom_to_ewkt(ret);
-	exp_wkt = lwgeom_to_ewkt(
-	    lwgeom_normalize(lwgeom_from_wkt(
+	tmp = lwgeom_from_wkt(
 					"MULTILINESTRING((0 0,8 0),(-2 0,0 0))",
-					LW_PARSER_CHECK_NONE)));
+					LW_PARSER_CHECK_NONE);
+	tmp2 = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
+	exp_wkt = lwgeom_to_ewkt(tmp2);
+	lwgeom_free(tmp2);
 	ASSERT_STRING_EQUAL(obt_wkt, exp_wkt);
 	lwfree(obt_wkt);
 	lwfree(exp_wkt);
@@ -95,17 +100,16 @@ static void test_lwgeom_wrapx(void)
 		"MULTILINESTRING((-5 -2,0 0),(0 0,10 10))",
 		LW_PARSER_CHECK_NONE);
 	CU_ASSERT_FATAL(geom != NULL);
-	ret = lwgeom_normalize(lwgeom_wrapx(geom, 0, 20));
+	tmp = lwgeom_wrapx(geom, 0, 20);
+	ret = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
 	CU_ASSERT_FATAL(ret != NULL);
 	obt_wkt = lwgeom_to_ewkt(ret);
-	exp_wkt = lwgeom_to_ewkt(
-							lwgeom_normalize(
-								lwgeom_from_wkt(
-								"MULTILINESTRING((15 -2,20 0),(0 0,10 10))"
-									, LW_PARSER_CHECK_NONE
-								)
-						)
-				);
+	tmp = lwgeom_from_wkt("MULTILINESTRING((15 -2,20 0),(0 0,10 10))", LW_PARSER_CHECK_NONE);
+	tmp2 = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
+	exp_wkt = lwgeom_to_ewkt(tmp2);
+	lwgeom_free(tmp2);
 	ASSERT_STRING_EQUAL(obt_wkt, exp_wkt);
 	lwfree(obt_wkt);
 	lwfree(exp_wkt);
@@ -119,11 +123,12 @@ static void test_lwgeom_wrapx(void)
 		")",
 		LW_PARSER_CHECK_NONE);
 	CU_ASSERT_FATAL(geom != NULL);
-	ret = lwgeom_normalize(lwgeom_wrapx(geom, 2, 20));
+	tmp = lwgeom_wrapx(geom, 2, 20);
+	ret = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
 	CU_ASSERT_FATAL(ret != NULL);
 	obt_wkt = lwgeom_to_ewkt(ret);
-	exp_wkt =
-	    lwgeom_to_ewkt(lwgeom_normalize(lwgeom_from_wkt("GEOMETRYCOLLECTION("
+	tmp = lwgeom_from_wkt("GEOMETRYCOLLECTION("
 							    "MULTIPOLYGON("
 							    "((22 0,20 0,20 10,22 10,22 4,22 2,22 0)),"
 							    "((2 10,10 10,10 0,2 0,2 2,4 2,4 4,2 4,2 10))"
@@ -133,7 +138,11 @@ static void test_lwgeom_wrapx(void)
 							    "((2 21,10 21,10 11,2 11,2 13,4 13,4 15,2 15,2 21))"
 							    ")"
 							    ")",
-							    LW_PARSER_CHECK_NONE)));
+							    LW_PARSER_CHECK_NONE);
+	tmp2 = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
+	exp_wkt = lwgeom_to_ewkt(tmp2);
+	lwgeom_free(tmp2);
 	ASSERT_STRING_EQUAL(obt_wkt, exp_wkt);
 	lwfree(obt_wkt);
 	lwfree(exp_wkt);
@@ -148,17 +157,22 @@ static void test_lwgeom_wrapx(void)
 		")",
 		LW_PARSER_CHECK_NONE);
 	CU_ASSERT_FATAL(geom != NULL);
-	ret = lwgeom_normalize(lwgeom_wrapx(geom, 0, 20));
+	tmp = lwgeom_wrapx(geom, 0, 20);
+	ret = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
 	CU_ASSERT_FATAL(ret != NULL);
 	obt_wkt = lwgeom_to_ewkt(ret);
-	exp_wkt = lwgeom_to_ewkt(
-			lwgeom_normalize(lwgeom_from_wkt(
+	tmp = lwgeom_from_wkt(
 	    "GEOMETRYCOLLECTION("
 	    "MULTILINESTRING((15 -2,20 0),(0 0,10 10)),"
 	    "POINT(15 0),"
 	    "POLYGON EMPTY"
 	    ")",
-	    LW_PARSER_CHECK_NONE)) );
+	    LW_PARSER_CHECK_NONE);
+	tmp2 = lwgeom_normalize(tmp);
+	lwgeom_free(tmp);
+	exp_wkt = lwgeom_to_ewkt(tmp2);
+	lwgeom_free(tmp2);
 	ASSERT_STRING_EQUAL(obt_wkt, exp_wkt);
 	lwfree(obt_wkt);
 	lwfree(exp_wkt);

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

Summary of changes:
 liblwgeom/cunit/cu_split.c | 12 ++++++----
 liblwgeom/cunit/cu_wrapx.c | 58 ++++++++++++++++++++++++++++------------------
 2 files changed, 44 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list