[postgis-tickets] r15865 - Fix memory leaks in BTREE operators
Sandro Santilli
strk at kbt.io
Sun Oct 1 11:31:56 PDT 2017
Author: strk
Date: 2017-10-01 11:31:56 -0700 (Sun, 01 Oct 2017)
New Revision: 15865
Modified:
branches/2.4/NEWS
branches/2.4/postgis/lwgeom_btree.c
Log:
Fix memory leaks in BTREE operators
References #3864 for 2.4 branch
Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS 2017-09-30 18:03:47 UTC (rev 15864)
+++ branches/2.4/NEWS 2017-10-01 18:31:56 UTC (rev 15865)
@@ -1,3 +1,9 @@
+PostGIS 2.4.1dev
+YYYY/MM/DD
+
+ * Bug fixes *
+ - #3864, Fix memory leaks in BTREE operators
+
PostGIS 2.4.0
2017/09/30
Modified: branches/2.4/postgis/lwgeom_btree.c
===================================================================
--- branches/2.4/postgis/lwgeom_btree.c 2017-09-30 18:03:47 UTC (rev 15864)
+++ branches/2.4/postgis/lwgeom_btree.c 2017-10-01 18:31:56 UTC (rev 15865)
@@ -52,6 +52,8 @@
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
if (cmp < 0)
PG_RETURN_BOOL(TRUE);
else
@@ -64,6 +66,8 @@
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
if (cmp == 0)
PG_RETURN_BOOL(TRUE);
else
@@ -76,6 +80,8 @@
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
if (cmp == 0)
PG_RETURN_BOOL(TRUE);
else
@@ -88,6 +94,8 @@
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
if (cmp >= 0)
PG_RETURN_BOOL(TRUE);
else
@@ -100,6 +108,8 @@
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
int cmp = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
if (cmp > 0)
PG_RETURN_BOOL(TRUE);
else
@@ -111,6 +121,9 @@
{
GSERIALIZED *g1 = PG_GETARG_GSERIALIZED_P(0);
GSERIALIZED *g2 = PG_GETARG_GSERIALIZED_P(1);
- PG_RETURN_INT32(gserialized_cmp(g1, g2));
+ int ret = gserialized_cmp(g1, g2);
+ PG_FREE_IF_COPY(g1, 0);
+ PG_FREE_IF_COPY(g2, 1);
+ PG_RETURN_INT32(ret);
}
More information about the postgis-tickets
mailing list