aboutsummaryrefslogtreecommitdiff
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:41 +0300
commit3a8e9e977fa642433986e5cd145e3a6f86601c2c (patch)
tree7e1951b6d3e9d79d45785dcad78453525e4acaae
parent8d6a07fa01cece1bd3508a81e59c0c0cbc0bb867 (diff)
downloadpostgresql-3a8e9e977fa642433986e5cd145e3a6f86601c2c.tar.gz
postgresql-3a8e9e977fa642433986e5cd145e3a6f86601c2c.zip
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 96f31c4c55b..88d27c7690e 100644
--- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
+++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
@@ -152,6 +152,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
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"),