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

Commit5ea8cfe

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 parent1a321fe commit5ea8cfe

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
@@ -500,6 +500,7 @@ buildACLCommands(const char *name, const char *subname,
500500
constchar*prefix,intremoteVersion,
501501
PQExpBuffersql)
502502
{
503+
boolok= true;
503504
char**aclitems;
504505
intnaclitems;
505506
inti;
@@ -570,8 +571,8 @@ buildACLCommands(const char *name, const char *subname,
570571
if (!parseAclItem(aclitems[i],type,name,subname,remoteVersion,
571572
grantee,grantor,privs,privswgo))
572573
{
573-
free(aclitems);
574-
return false;
574+
ok= false;
575+
break;
575576
}
576577

577578
if (grantor->len==0&&owner)
@@ -678,7 +679,7 @@ buildACLCommands(const char *name, const char *subname,
678679

679680
free(aclitems);
680681

681-
returntrue;
682+
returnok;
682683
}
683684

684685
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp