mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
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
This commit is contained in:
@ -12531,7 +12531,7 @@ dumpFunc(Archive *fout, const FuncInfo *finfo)
|
|||||||
|
|
||||||
if (*protrftypes)
|
if (*protrftypes)
|
||||||
{
|
{
|
||||||
Oid *typeids = palloc(FUNC_MAX_ARGS * sizeof(Oid));
|
Oid *typeids = pg_malloc(FUNC_MAX_ARGS * sizeof(Oid));
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
appendPQExpBufferStr(q, " TRANSFORM ");
|
appendPQExpBufferStr(q, " TRANSFORM ");
|
||||||
@ -12543,6 +12543,8 @@ dumpFunc(Archive *fout, const FuncInfo *finfo)
|
|||||||
appendPQExpBuffer(q, "FOR TYPE %s",
|
appendPQExpBuffer(q, "FOR TYPE %s",
|
||||||
getFormattedTypeName(fout, typeids[i], zeroAsNone));
|
getFormattedTypeName(fout, typeids[i], zeroAsNone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(typeids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prokind[0] == PROKIND_WINDOW)
|
if (prokind[0] == PROKIND_WINDOW)
|
||||||
|
Reference in New Issue
Block a user