diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-06-03 11:52:52 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-06-03 11:52:52 -0400 |
commit | d73b7f973db5ec7e44813141741d3e0d318eef69 (patch) | |
tree | d7fb266a9def3bd7d883fdfe81758e0f1d2507c1 /src | |
parent | 8fcbfea7885f53b5a16610f7f03c276df49ef3d4 (diff) | |
download | postgresql-d73b7f973db5ec7e44813141741d3e0d318eef69.tar.gz postgresql-d73b7f973db5ec7e44813141741d3e0d318eef69.zip |
Fix memory leaks in failure paths in buildACLCommands and parseAclItem.
This is currently only cosmetic, since all the call sites just curl up
and die in event of a failure return. It might be important for some
future use-case, though, and in any case it quiets warnings from the
clang static analyzer (as reported by Anna Zaks).
Josh Kupershmidt
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/dumputils.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 623c250eb89..6d10970e7c8 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -600,7 +600,10 @@ buildACLCommands(const char *name, const char *subname, { if (!parseAclItem(aclitems[i], type, name, subname, remoteVersion, grantee, grantor, privs, privswgo)) + { + free(aclitems); return false; + } if (grantor->len == 0 && owner) printfPQExpBuffer(grantor, "%s", owner); @@ -789,7 +792,10 @@ parseAclItem(const char *item, const char *type, /* user or group name is string up to = */ eqpos = copyAclUserName(grantee, buf); if (*eqpos != '=') + { + free(buf); return false; + } /* grantor may be listed after / */ slpos = strchr(eqpos + 1, '/'); @@ -798,7 +804,10 @@ parseAclItem(const char *item, const char *type, *slpos++ = '\0'; slpos = copyAclUserName(grantor, slpos); if (*slpos != '\0') + { + free(buf); return false; + } } else resetPQExpBuffer(grantor); |