aboutsummaryrefslogtreecommitdiff
path: root/contrib/btree_gist/btree_ts.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2005-02-21 10:47:52 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2005-02-21 10:47:52 +0000
commitf49d69b813bf7c84566b082913b97ef40f568d2d (patch)
tree8c77576578a280082ea5169827d9a7034b9541e0 /contrib/btree_gist/btree_ts.c
parent14fd629aea60b9ce14f3f24a4a283943ab073aa7 (diff)
downloadpostgresql-f49d69b813bf7c84566b082913b97ef40f568d2d.tar.gz
postgresql-f49d69b813bf7c84566b082913b97ef40f568d2d.zip
Fix memory leak for timestamp(with and w/o tz) and time indexes
Diffstat (limited to 'contrib/btree_gist/btree_ts.c')
-rw-r--r--contrib/btree_gist/btree_ts.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c
index f9d801a3fc1..aaa0c2e5a4b 100644
--- a/contrib/btree_gist/btree_ts.c
+++ b/contrib/btree_gist/btree_ts.c
@@ -29,6 +29,8 @@ Datum gbt_ts_penalty(PG_FUNCTION_ARGS);
Datum gbt_ts_same(PG_FUNCTION_ARGS);
+#define P_TimestampGetDatum(x) PointerGetDatum( &(x) )
+
static bool
gbt_tsgt(const void *a, const void *b)
{
@@ -231,8 +233,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
- TimestampGetDatum(newentry->upper),
- TimestampGetDatum(origentry->upper)
+ P_TimestampGetDatum(newentry->upper),
+ P_TimestampGetDatum(origentry->upper)
));
/* see interval_larger */
@@ -242,8 +244,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
- TimestampGetDatum(origentry->lower),
- TimestampGetDatum(newentry->lower)
+ P_TimestampGetDatum(origentry->lower),
+ P_TimestampGetDatum(newentry->lower)
));
/* see interval_larger */
@@ -256,8 +258,8 @@ gbt_ts_penalty(PG_FUNCTION_ARGS)
{
intr = DatumGetIntervalP(DirectFunctionCall2(
timestamp_mi,
- TimestampGetDatum(origentry->upper),
- TimestampGetDatum(origentry->lower)
+ P_TimestampGetDatum(origentry->upper),
+ P_TimestampGetDatum(origentry->lower)
));
*result += FLT_MIN;
*result += (float) (res / ((double) (res + intr->time + intr->month * (30 * 86400))));