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

Commit6794a9f

Browse files
committed
Avoid minor leak in parallel pg_dump
During parallel pg_dump, a worker process closing the connection causeda minor memory leak (particularly minor as we are likely about to exitanyway). Instead, free the memory in this case prior to returning NULLto indicate connection closed.Spotting by the Coverity scanner.Back patch to 9.3 where this was introduced.
1 parentd150ff5 commit6794a9f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/bin/pg_dump/parallel.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ readMessageFromPipe(int fd)
12881288

12891289
/* worker has closed the connection or another error happened */
12901290
if (ret <=0)
1291-
returnNULL;
1291+
break;
12921292

12931293
Assert(ret==1);
12941294

@@ -1303,6 +1303,14 @@ readMessageFromPipe(int fd)
13031303
msg= (char*)realloc(msg,bufsize);
13041304
}
13051305
}
1306+
1307+
/*
1308+
* Worker has closed the connection, make sure to clean up before return
1309+
* since we are not returning msg (but did allocate it).
1310+
*/
1311+
free(msg);
1312+
1313+
returnNULL;
13061314
}
13071315

13081316
#ifdefWIN32

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp