postgres.git / summary / log / commit / refs

commit    3a8e9e977fa642433986e5cd145e3a6f86601c2c
Author:   Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date:     Tue May 06 12:14:51 2014 +0000
First released in: 9.4.0, 9.0.18, 9.1.14, 9.2.9, 9.3.5

    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


src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 1 + 1 file changed, 1 insertion(+) 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"), [parent: 8d6a07fa01ce]