From 766176fe241907c4e5fde42d9395121c3ce4ac02 Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Sun, 21 Apr 2019 12:58:43 +0000 Subject: [PATCH] Reallocate Union state in aggregate context. References #4382 git-svn-id: http://svn.osgeo.org/postgis/trunk@17403 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/lwgeom_geos.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index 3718fe92c..6f56963d9 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -593,7 +593,9 @@ Datum pgis_geometry_union_transfn(PG_FUNCTION_ARGS) if (state->ngeoms > state->alen) { state->alen *= 2; + MemoryContext old = MemoryContextSwitchTo(aggcontext); state->geoms = repalloc(state->geoms, state->alen); + MemoryContextSwitchTo(old); } state->geoms[curgeom] = g; -- 2.40.0