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

Commit94bc1c5

Browse files
committed
Fix use of already freed memory when dumping a database's security label.
pg_dump.c:dumDatabase() called ArchiveEntry() with the results of a aquery that was PQclear()ed a couple lines earlier.Backpatch to 9.2 where security labels for shared objects whereintroduced.
1 parent6bbf751 commit94bc1c5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,25 +2465,29 @@ dumpDatabase(Archive *fout)
24652465
dbCatId,0,dbDumpId);
24662466
}
24672467

2468-
PQclear(res);
2469-
24702468
/* Dump shared security label. */
24712469
if (!no_security_labels&&fout->remoteVersion >=90200)
24722470
{
2473-
PQExpBufferseclabelQry=createPQExpBuffer();
2471+
PGresult*shres;
2472+
PQExpBufferseclabelQry;
2473+
2474+
seclabelQry=createPQExpBuffer();
24742475

24752476
buildShSecLabelQuery(conn,"pg_database",dbCatId.oid,seclabelQry);
2476-
res=ExecuteSqlQuery(fout,seclabelQry->data,PGRES_TUPLES_OK);
2477+
shres=ExecuteSqlQuery(fout,seclabelQry->data,PGRES_TUPLES_OK);
24772478
resetPQExpBuffer(seclabelQry);
2478-
emitShSecLabels(conn,res,seclabelQry,"DATABASE",datname);
2479+
emitShSecLabels(conn,shres,seclabelQry,"DATABASE",datname);
24792480
if (strlen(seclabelQry->data))
24802481
ArchiveEntry(fout,dbCatId,createDumpId(),datname,NULL,NULL,
24812482
dba, false,"SECURITY LABEL",SECTION_NONE,
24822483
seclabelQry->data,"",NULL,
24832484
&dbDumpId,1,NULL,NULL);
24842485
destroyPQExpBuffer(seclabelQry);
2486+
PQclear(shres);
24852487
}
24862488

2489+
PQclear(res);
2490+
24872491
destroyPQExpBuffer(dbQry);
24882492
destroyPQExpBuffer(delQry);
24892493
destroyPQExpBuffer(creaQry);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp