Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b63f89

Browse files
committed
Fix more memory leaks in failure path in buildACLCommands.
We already had one go at this issue in commitd73b7f9, but wefailed to notice that buildACLCommands also leaked several PQExpBuffersalong with a simply malloc'd string. This time let's try to make thefix a bit more future-proof by eliminating the separate exit path.It's still not exactly critical because pg_dump will curl up and die onfailure; but since the amount of the potential leak is now several KB,it seems worth back-patching as far as 9.2 where the previous fix landed.Per Coverity, which evidently is smarter than clang's static analyzer.
1 parent9be9ac4 commit8b63f89

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/bin/pg_dump/dumputils.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ buildACLCommands(const char *name, const char *subname,
531531
constchar*prefix,intremoteVersion,
532532
PQExpBuffersql)
533533
{
534+
boolok= true;
534535
char**aclitems;
535536
intnaclitems;
536537
inti;
@@ -601,8 +602,8 @@ buildACLCommands(const char *name, const char *subname,
601602
if (!parseAclItem(aclitems[i],type,name,subname,remoteVersion,
602603
grantee,grantor,privs,privswgo))
603604
{
604-
free(aclitems);
605-
return false;
605+
ok= false;
606+
break;
606607
}
607608

608609
if (grantor->len==0&&owner)
@@ -709,7 +710,7 @@ buildACLCommands(const char *name, const char *subname,
709710

710711
free(aclitems);
711712

712-
returntrue;
713+
returnok;
713714
}
714715

715716
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp