From: Paul Ramsey <pramsey@cleverelephant.ca> Date: Mon, 29 Jun 2015 17:00:47 +0000 (+0000) Subject: Remove memory leak X-Git-Tag: 2.2.0rc1~293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=202838e6520f532c009f06f557f87da8fbce4bc1;p=postgis Remove memory leak git-svn-id: http://svn.osgeo.org/postgis/trunk@13745 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/liblwgeom/cunit/cu_ptarray.c b/liblwgeom/cunit/cu_ptarray.c index 4f5673032..46e8022de 100644 --- a/liblwgeom/cunit/cu_ptarray.c +++ b/liblwgeom/cunit/cu_ptarray.c @@ -698,30 +698,40 @@ static void test_ptarray_scale() wkt = "LINESTRING ZM (0 1 2 3,1 2 3 0,-2 -3 0 -1,-3 0 -1 -2)"; line = lwgeom_as_lwline(lwgeom_from_text(wkt)); pa = line->points; + factor.x = factor.y = factor.z = factor.m = 1; ptarray_scale(pa, &factor); wktout = lwgeom_to_text(lwline_as_lwgeom(line)); ASSERT_STRING_EQUAL(wktout, wkt); + lwfree(wktout); + factor.x = 2; wkt = "LINESTRING ZM (0 1 2 3,2 2 3 0,-4 -3 0 -1,-6 0 -1 -2)"; ptarray_scale(pa, &factor); wktout = lwgeom_to_text(lwline_as_lwgeom(line)); ASSERT_STRING_EQUAL(wktout, wkt); + lwfree(wktout); + factor.x = 1; factor.y = 3; wkt = "LINESTRING ZM (0 3 2 3,2 6 3 0,-4 -9 0 -1,-6 0 -1 -2)"; ptarray_scale(pa, &factor); wktout = lwgeom_to_text(lwline_as_lwgeom(line)); ASSERT_STRING_EQUAL(wktout, wkt); + lwfree(wktout); + factor.x = 1; factor.y = 1; factor.z = -2; wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 -0 -1,-6 0 2 -2)"; ptarray_scale(pa, &factor); wktout = lwgeom_to_text(lwline_as_lwgeom(line)); ASSERT_STRING_EQUAL(wktout, wkt); + lwfree(wktout); + factor.x = 1; factor.y = 1; factor.z = 1; factor.m = 2; wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 -0 -2,-6 0 2 -4)"; ptarray_scale(pa, &factor); wktout = lwgeom_to_text(lwline_as_lwgeom(line)); ASSERT_STRING_EQUAL(wktout, wkt); + lwfree(wktout); lwline_free(line); }