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

Commit1a29217

Browse files
Free temporary memory when reading TOC
ReadStr returns allocated memory which the caller is responsible forfreeing when done with the string. This commit ensures that memory isfreed in one case which used ReadStr in a conditional. While the leakmight not be too concerning, this makes the code consistent across allReadStr callsites in ReadToc. Due to the lack of complaints of issuesin production from this, no backpatch is performed at this point.Author: Bharath Rupireddy, Georgios KokolatosReviewed-by: Kyotaro HoriguchiDiscussion:https://postgr.es/m/oZwKiUxFsVaetG2xOJp7Hwao8F1AKIdfFDQLNJrnwoaxmjyB-45r_aYmhgXHKLcMI3GT24m9L6HafSi2ns7WFxXe0mw2_tIJpD-Z3vb_eyI=@pm.me
1 parentcf29a11 commit1a29217

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,6 +2494,7 @@ ReadToc(ArchiveHandle *AH)
24942494
intdepIdx;
24952495
intdepSize;
24962496
TocEntry*te;
2497+
boolis_supported;
24972498

24982499
AH->tocCount=ReadInt(AH);
24992500
AH->maxDumpId=0;
@@ -2574,7 +2575,20 @@ ReadToc(ArchiveHandle *AH)
25742575
te->tableam=ReadStr(AH);
25752576

25762577
te->owner=ReadStr(AH);
2577-
if (AH->version<K_VERS_1_9||strcmp(ReadStr(AH),"true")==0)
2578+
is_supported= true;
2579+
if (AH->version<K_VERS_1_9)
2580+
is_supported= false;
2581+
else
2582+
{
2583+
tmp=ReadStr(AH);
2584+
2585+
if (strcmp(tmp,"true")==0)
2586+
is_supported= false;
2587+
2588+
free(tmp);
2589+
}
2590+
2591+
if (!is_supported)
25782592
pg_log_warning("restoring tables WITH OIDS is not supported anymore");
25792593

25802594
/* Read TOC entry dependencies */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp