diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2005-02-21 10:03:57 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2005-02-21 10:03:57 +0000 |
commit | 47979e671c9753d92df0cb4187908c9fb043a96b (patch) | |
tree | 40726f70b02c0030539c0911e99c3553d2dbe233 /contrib/btree_gist/btree_ts.c | |
parent | 70b64cfbf4027d1445ca43e1e06c243049539c48 (diff) | |
download | postgresql-47979e671c9753d92df0cb4187908c9fb043a96b.tar.gz postgresql-47979e671c9753d92df0cb4187908c9fb043a96b.zip |
Fix memory leak for timestamp(with and w/o tz) and indexes
Diffstat (limited to 'contrib/btree_gist/btree_ts.c')
-rw-r--r-- | contrib/btree_gist/btree_ts.c | 14 |
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)))); |