aboutsummaryrefslogtreecommitdiffstats
path: root/sql/date.c
diff options
context:
space:
mode:
Diffstat (limited to 'sql/date.c')
-rw-r--r--sql/date.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/date.c b/sql/date.c
index b64e095b..14f26a63 100644
--- a/sql/date.c
+++ b/sql/date.c
@@ -64,7 +64,7 @@ Datum cds_accrued(PG_FUNCTION_ARGS) {
DateADT d = PG_GETARG_DATEADT(0);
float8 coupon = PG_GETARG_FLOAT8(1);
bool include_cashflow = PG_GETARG_BOOL(2);
- const char* currency = text_to_cstring(PG_GETARG_TEXT_PP(3));
+ char* currency = text_to_cstring(PG_GETARG_TEXT_PP(3));
const char* cal;
if (strcmp(currency, "USD") == 0) {
@@ -82,5 +82,6 @@ Datum cds_accrued(PG_FUNCTION_ARGS) {
if ((date_prev == date) && include_cashflow) {
date_prev = _previous_twentieth(date - 1, true, cal);
}
+ pfree(currency);
PG_RETURN_FLOAT8((date - date_prev) / 360. * coupon);
}