Skip to content

Commit ca4cf09

Browse files
committed
Back out pfrees for justify_hour function calls.
1 parent ea849a2 commit ca4cf09

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/backend/utils/adt/timestamp.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.149 2005/08/25 01:30:06 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.150 2005/08/25 03:53:22 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1892,7 +1892,7 @@ timestamp_mi(PG_FUNCTION_ARGS)
18921892
{
18931893
Timestamp dt1 = PG_GETARG_TIMESTAMP(0);
18941894
Timestamp dt2 = PG_GETARG_TIMESTAMP(1);
1895-
Interval *result, *result2;
1895+
Interval *result;
18961896

18971897
result = (Interval *) palloc(sizeof(Interval));
18981898

@@ -1914,10 +1914,9 @@ timestamp_mi(PG_FUNCTION_ARGS)
19141914
result->month = 0;
19151915
result->day = 0;
19161916

1917-
result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
1917+
result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
19181918
IntervalPGetDatum(result)));
1919-
pfree(result);
1920-
PG_RETURN_INTERVAL_P(result2);
1919+
PG_RETURN_INTERVAL_P(result);
19211920
}
19221921

19231922
/* interval_justify_hours()
@@ -2264,7 +2263,7 @@ interval_mul(PG_FUNCTION_ARGS)
22642263
Interval *span = PG_GETARG_INTERVAL_P(0);
22652264
float8 factor = PG_GETARG_FLOAT8(1);
22662265
double month_remainder, day_remainder;
2267-
Interval *result, *result2;
2266+
Interval *result;
22682267

22692268
result = (Interval *) palloc(sizeof(Interval));
22702269

@@ -2290,10 +2289,9 @@ interval_mul(PG_FUNCTION_ARGS)
22902289
day_remainder * SECS_PER_DAY);
22912290
#endif
22922291

2293-
result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
2292+
result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
22942293
IntervalPGetDatum(result)));
2295-
pfree(result);
2296-
PG_RETURN_INTERVAL_P(result2);
2294+
PG_RETURN_INTERVAL_P(result);
22972295
}
22982296

22992297
Datum
@@ -2312,7 +2310,7 @@ interval_div(PG_FUNCTION_ARGS)
23122310
Interval *span = PG_GETARG_INTERVAL_P(0);
23132311
float8 factor = PG_GETARG_FLOAT8(1);
23142312
double month_remainder, day_remainder;
2315-
Interval *result, *result2;
2313+
Interval *result;
23162314

23172315
result = (Interval *) palloc(sizeof(Interval));
23182316

@@ -2343,10 +2341,9 @@ interval_div(PG_FUNCTION_ARGS)
23432341
result->time = JROUND(result->time);
23442342
#endif
23452343

2346-
result2 = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
2344+
result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
23472345
IntervalPGetDatum(result)));
2348-
pfree(result);
2349-
PG_RETURN_INTERVAL_P(result2);
2346+
PG_RETURN_INTERVAL_P(result);
23502347
}
23512348

23522349
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy