pg_dump: Don't leak memory in buildDefaultACLCommands()
buildDefaultACLCommands() didn't destroy the string buffer created in certain cases, leading to a memory leak. Fix by destroying the buffer before returning from the function. Spotted by Coverity. Author: Michael Paquier Back-patch to 9.6 where buildDefaultACLCommands() was added.
This commit is contained in:
parent
aa5d3c0b3f
commit
09f8421819
@ -390,13 +390,19 @@ buildDefaultACLCommands(const char *type, const char *nspname,
|
||||
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\n");
|
||||
if (!buildACLCommands("", NULL, type, initacls, initracls, owner,
|
||||
prefix->data, remoteVersion, sql))
|
||||
{
|
||||
destroyPQExpBuffer(prefix);
|
||||
return false;
|
||||
}
|
||||
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\n");
|
||||
}
|
||||
|
||||
if (!buildACLCommands("", NULL, type, acls, racls, owner,
|
||||
prefix->data, remoteVersion, sql))
|
||||
{
|
||||
destroyPQExpBuffer(prefix);
|
||||
return false;
|
||||
}
|
||||
|
||||
destroyPQExpBuffer(prefix);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user