summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-06 15:14:51 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-05-06 15:17:07 +0300
commite0070a6858cfcd2c4129dfa93bc042d6d86732c8 (patch)
tree26564d889d42a52da0ec5866a347003fcd34f296
parentfb66e88cf8f7ce7abf27cff1570a703e1cb8f562 (diff)
Fix use of free in walsender error handling after a sysid mismatch.
Found via valgrind. The bug exists since the introduction of the walsender, so backpatch to 9.0. Andres Freund
-rw-r--r--src/backend/replication/libpqwalreceiver/libpqwalreceiver.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
index 0831b1b2ded..85aa12714c5 100644
--- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
+++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
@@ -135,6 +135,7 @@ libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
GetSystemIdentifier());
if (strcmp(primary_sysid, standby_sysid) != 0)
{
+ primary_sysid = pstrdup(primary_sysid);
PQclear(res);
ereport(ERROR,
(errmsg("database system identifier differs between the primary and standby"),