Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0e033f5

Browse files
Fix a memory leak in dumping functions with TRANSFORMs
The gneration of the dump clause for functions with TRANSFORM calls would leak the memory for holding the result of the Oid array parsing. Fix by freeing. While in there, switch to using pg_malloc instead of palloc in order to be consistent with the rest of the file. Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/baf1ae4511288e5b421f41e79a3df1a0@postgrespro.ru
1 parent 9df2a4b commit 0e033f5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12531,7 +12531,7 @@ dumpFunc(Archive *fout, const FuncInfo *finfo)
1253112531

1253212532
if (*protrftypes)
1253312533
{
12534-
Oid *typeids = palloc(FUNC_MAX_ARGS * sizeof(Oid));
12534+
Oid *typeids = pg_malloc(FUNC_MAX_ARGS * sizeof(Oid));
1253512535
int i;
1253612536

1253712537
appendPQExpBufferStr(q, " TRANSFORM ");
@@ -12543,6 +12543,8 @@ dumpFunc(Archive *fout, const FuncInfo *finfo)
1254312543
appendPQExpBuffer(q, "FOR TYPE %s",
1254412544
getFormattedTypeName(fout, typeids[i], zeroAsNone));
1254512545
}
12546+
12547+
free(typeids);
1254612548
}
1254712549

1254812550
if (prokind[0] == PROKIND_WINDOW)

0 commit comments

Comments
 (0)