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

Commit369d494

Browse files
committed
Cleanup minor pg_dump memory leaks
In dumputils, we may have successfully parsed the acls when we discoverthat we can't parse the reverse ACLs and then return- check and freeaclitems if that happens.In dumpTableSchema, move ftoptions and srvname under the relkind !=RELKIND_VIEW branch (since they're only used there) and then check ifthey've been allocated and, if so, free them at the end of that block.Pointed out by Pavel Raiskup, though I didn't use those patches.Discussion:https://postgr.es/m/2183976.vkCJMhdhmF@nb.usersys.redhat.com
1 parenta243c55 commit369d494

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

‎src/bin/pg_dump/dumputils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ buildACLCommands(const char *name, const char *subname, const char *nspname,
9595
{
9696
if (!parsePGArray(racls,&raclitems,&nraclitems))
9797
{
98+
if (aclitems)
99+
free(aclitems);
98100
if (raclitems)
99101
free(raclitems);
100102
return false;

‎src/bin/pg_dump/pg_dump.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15303,8 +15303,6 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1530315303
intactual_atts;/* number of attrs in this CREATE statement */
1530415304
const char *reltypename;
1530515305
char *storage;
15306-
char *srvname;
15307-
char *ftoptions;
1530815306
intj,
1530915307
k;
1531015308

@@ -15361,6 +15359,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1536115359
}
1536215360
else
1536315361
{
15362+
char *ftoptions = NULL;
15363+
char *srvname = NULL;
15364+
1536415365
switch (tbinfo->relkind)
1536515366
{
1536615367
case RELKIND_FOREIGN_TABLE:
@@ -15397,13 +15398,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1539715398
}
1539815399
case RELKIND_MATVIEW:
1539915400
reltypename = "MATERIALIZED VIEW";
15400-
srvname = NULL;
15401-
ftoptions = NULL;
1540215401
break;
1540315402
default:
1540415403
reltypename = "TABLE";
15405-
srvname = NULL;
15406-
ftoptions = NULL;
1540715404
}
1540815405

1540915406
numParents = tbinfo->numParents;
@@ -15951,6 +15948,11 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
1595115948
tbinfo->attfdwoptions[j]);
1595215949
}
1595315950
}
15951+
15952+
if (ftoptions)
15953+
free(ftoptions);
15954+
if (srvname)
15955+
free(srvname);
1595415956
}
1595515957

1595615958
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp