Skip to content

Commit 09f8421

Browse files
committed
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.
1 parent aa5d3c0 commit 09f8421

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bin/pg_dump/dumputils.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,19 @@ buildDefaultACLCommands(const char *type, const char *nspname,
390390
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\n");
391391
if (!buildACLCommands("", NULL, type, initacls, initracls, owner,
392392
prefix->data, remoteVersion, sql))
393+
{
394+
destroyPQExpBuffer(prefix);
393395
return false;
396+
}
394397
appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\n");
395398
}
396399

397400
if (!buildACLCommands("", NULL, type, acls, racls, owner,
398401
prefix->data, remoteVersion, sql))
402+
{
403+
destroyPQExpBuffer(prefix);
399404
return false;
405+
}
400406

401407
destroyPQExpBuffer(prefix);
402408

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy