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

Commit198efe7

Browse files
committed
Fix minor memory leak in pg_basebackup and pg_receivewal
The result of the query used to retrieve the WAL segment size from thebackend was not getting freed in two code paths. Both pg_basebackup andpg_receivewal exit immediately if a failure happened on this query, sothis was not an actual problem, but it could be an issue if this codegets used for other tools in different ways, be they future tools inthis code tree or external, existing, ones.Oversight in commitfc49e24, so backpatch down to 11.Author: Jie ZhangDiscussion:https://postgr.es/m/970ad9508461469b9450b64027842331@G08CNEXMBPEKD06.g08.fujitsu.localBackpatch-through: 11
1 parent5b736e9 commit198efe7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/bin/pg_basebackup/streamutil.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,12 @@ RetrieveWalSegSize(PGconn *conn)
313313
if (sscanf(PQgetvalue(res,0,0),"%d%s",&xlog_val,xlog_unit)!=2)
314314
{
315315
pg_log_error("WAL segment size could not be parsed");
316+
PQclear(res);
316317
return false;
317318
}
318319

320+
PQclear(res);
321+
319322
/* set the multiplier based on unit to convert xlog_val to bytes */
320323
if (strcmp(xlog_unit,"MB")==0)
321324
multiplier=1024*1024;
@@ -334,7 +337,6 @@ RetrieveWalSegSize(PGconn *conn)
334337
return false;
335338
}
336339

337-
PQclear(res);
338340
return true;
339341
}
340342

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp