From fb65744bee4306daf77d40dd5556d9151337b41c Mon Sep 17 00:00:00 2001 From: reshke Date: Sat, 17 Jan 2026 10:48:17 +0000 Subject: [PATCH v1] Cleanup palloc'd strucrs on sotf error path in `record_out` Introduced ccff2d20ed96 (XXX: double check that ccff2d20ed96~1 does not suffer from this) --- src/backend/utils/adt/rowtypes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c index db67e86e760..fcf8a5ea5e8 100644 --- a/src/backend/utils/adt/rowtypes.c +++ b/src/backend/utils/adt/rowtypes.c @@ -148,6 +148,9 @@ record_in(PG_FUNCTION_ARGS) * each column, which is then fed to the appropriate input converter. */ ptr = string; + + initStringInfo(&buf); + /* Allow leading whitespace */ while (*ptr && isspace((unsigned char) *ptr)) ptr++; @@ -160,7 +163,6 @@ record_in(PG_FUNCTION_ARGS) goto fail; } - initStringInfo(&buf); for (i = 0; i < ncolumns; i++) { @@ -318,6 +320,9 @@ record_in(PG_FUNCTION_ARGS) /* exit here once we've done lookup_rowtype_tupdesc */ fail: + pfree(buf.data); + pfree(values); + pfree(nulls); ReleaseTupleDesc(tupdesc); PG_RETURN_NULL(); } -- 2.43.0