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

Commit4f1d33d

Browse files
committed
In psql, avoid leaking a PGresult after a query is cancelled.
After a query cancel, the tail end of ExecQueryAndProcessResultstook care to clear any not-yet-read PGresults; but it forgot aboutthe one it has already read. There would only be such a resultwhen handling a multi-command string made with "\;", so that you'dhave to cancel an earlier command in such a string to reach thebug at all. Even then, there would only be leakage of a singlePGresult per cancel, so it's not surprising nobody noticed this.But a leak is a leak.Noted while re-reviewing90f5178, but this is independent of that:it dates to7844c99. Back-patch to v15 where that came in.
1 parentdcb7cf9 commit4f1d33d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/bin/psql/common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,8 @@ ExecQueryAndProcessResults(const char *query,
16251625

16261626
if (cancel_pressed)
16271627
{
1628+
/* drop this next result, as well as any others not yet read */
1629+
ClearOrSaveResult(result);
16281630
ClearOrSaveAllResults();
16291631
break;
16301632
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp