[SCM] PostGIS branch stable-3.6 updated. 3.6.0-29-g9b1071fcd
git at osgeo.org
git at osgeo.org
Fri Nov 7 13:33:19 PST 2025
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, stable-3.6 has been updated
via 9b1071fcdb51c53af15942a6bd31cb51e57d602b (commit)
via b85bce7cbeb15595e9e4f59cb7098f58c0274706 (commit)
from 21517f662368c90bbee0dfdebff3cb82059467fd (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 9b1071fcdb51c53af15942a6bd31cb51e57d602b
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Nov 7 13:33:10 2025 -0800
News entry for #6012
diff --git a/NEWS b/NEWS
index 7a06e124f..7e316b9ee 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ PostGIS 3.6.1
authored: Andrey Borodin (Yandex), reported by Sergey Bobrov (Kaspersky)
- #5754, ST_ForcePolygonCCW reverses lines (Paul Ramsey)
- #5959, #5984, Prevent histogram target overflow when analysing massive tables (Darafei Praliaskouski)
+ - #6012, Remove memory leak from lwcircstring_from_lwpointarray (Paul Ramsey)
PostGIS 3.6.0
commit b85bce7cbeb15595e9e4f59cb7098f58c0274706
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri Nov 7 13:23:05 2025 -0800
fix memory leak, references #6012
diff --git a/liblwgeom/lwcircstring.c b/liblwgeom/lwcircstring.c
index 71a1556bf..ec0d05b27 100644
--- a/liblwgeom/lwcircstring.c
+++ b/liblwgeom/lwcircstring.c
@@ -34,14 +34,13 @@
void printLWCIRCSTRING(LWCIRCSTRING *curve);
void lwcircstring_release(LWCIRCSTRING *lwcirc);
char lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you);
-LWCIRCSTRING *lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, LWPOINT **points);
+LWCIRCSTRING *lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, const LWPOINT **points);
LWCIRCSTRING *lwcircstring_from_lwmpoint(int32_t srid, LWMPOINT *mpoint);
LWCIRCSTRING *lwcircstring_addpoint(LWCIRCSTRING *curve, LWPOINT *point, uint32_t where);
LWCIRCSTRING *lwcircstring_removepoint(LWCIRCSTRING *curve, uint32_t index);
void lwcircstring_setPoint4d(LWCIRCSTRING *curve, uint32_t index, POINT4D *newpoint);
-
/*
* Construct a new LWCIRCSTRING. points will *NOT* be copied
* use SRID=SRID_UNKNOWN for unknown SRID (will have 8bit type's S = 0)
@@ -138,49 +137,44 @@ lwcircstring_same(const LWCIRCSTRING *me, const LWCIRCSTRING *you)
* LWCIRCSTRING dimensions are large enough to host all input dimensions.
*/
LWCIRCSTRING *
-lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, LWPOINT **points)
+lwcircstring_from_lwpointarray(int32_t srid, uint32_t npoints, const LWPOINT **points)
{
- int zmflag=0;
uint32_t i;
POINTARRAY *pa;
- uint8_t *newpoints, *ptr;
- size_t ptsize, size;
+ int has_z = 0, has_m = 0;
+ POINT4D pt;
/*
* Find output dimensions, check integrity
*/
for (i = 0; i < npoints; i++)
{
- if (points[i]->type != POINTTYPE)
+ const LWGEOM *lwg = (LWGEOM*)points[i];
+ if (lwg->type != POINTTYPE)
{
- lwerror("lwcurve_from_lwpointarray: invalid input type: %s",
- lwtype_name(points[i]->type));
+ lwerror("%s: invalid input type: %s", __func__, lwtype_name(lwg->type));
return NULL;
}
- if (FLAGS_GET_Z(points[i]->flags)) zmflag |= 2;
- if (FLAGS_GET_M(points[i]->flags)) zmflag |= 1;
- if (zmflag == 3) break;
+ has_z |= lwgeom_has_z(lwg);
+ has_m |= lwgeom_has_m(lwg);
+ if (has_z && has_m) break;
}
- if (zmflag == 0) ptsize = 2 * sizeof(double);
- else if (zmflag == 3) ptsize = 4 * sizeof(double);
- else ptsize = 3 * sizeof(double);
-
/*
* Allocate output points array
*/
- size = ptsize * npoints;
- newpoints = lwalloc(size);
- memset(newpoints, 0, size);
+ pa = ptarray_construct(has_z, has_m, npoints);
- ptr = newpoints;
for (i = 0; i < npoints; i++)
{
- size = ptarray_point_size(points[i]->point);
- memcpy(ptr, getPoint_internal(points[i]->point, 0), size);
- ptr += ptsize;
+ const LWPOINT *lwpt = points[i];
+ if (!getPoint4d_p(lwpt->point, 0, &pt))
+ {
+ lwerror("%s: failed getPoint4d_p", __func__);
+ return NULL;
+ }
+ ptarray_set_point4d(pa, i, &pt);
}
- pa = ptarray_construct_reference_data(zmflag&2, zmflag&1, npoints, newpoints);
return lwcircstring_construct(srid, NULL, pa);
}
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/lwcircstring.c | 42 ++++++++++++++++++------------------------
2 files changed, 19 insertions(+), 24 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list