mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
Avoid a use-after-free in verbose logging
Previously, this print would use memory freed by PQClear previously. Signed-off-by: Dan Farina <drfarina@acm.org>
This commit is contained in:
11
repmgr.c
11
repmgr.c
@@ -974,6 +974,12 @@ stop_backup:
|
||||
return;
|
||||
}
|
||||
last_wal_segment = PQgetvalue(res, 0, 0);
|
||||
|
||||
if (verbose)
|
||||
printf(
|
||||
_("%s requires primary to keep WAL files %s until at least %s\n"),
|
||||
progname, first_wal_segment, last_wal_segment);
|
||||
|
||||
PQclear(res);
|
||||
PQfinish(conn);
|
||||
|
||||
@@ -981,11 +987,6 @@ stop_backup:
|
||||
if (r != 0)
|
||||
return;
|
||||
|
||||
if (verbose)
|
||||
printf(
|
||||
_("%s requires primary to keep WAL files %s until at least %s\n"),
|
||||
progname, first_wal_segment, last_wal_segment);
|
||||
|
||||
/*
|
||||
* We need to create the pg_xlog sub directory too, I'm reusing a variable
|
||||
* here.
|
||||
|
||||
Reference in New Issue
Block a user