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
This commit is contained in:
Heikki Linnakangas 2014-05-06 15:14:51 +03:00
parent 8d6a07fa01
commit 3a8e9e977f
1 changed files with 1 additions and 0 deletions

View File

@ -152,6 +152,7 @@ libpqrcv_identify_system(TimeLineID *primary_tli)
GetSystemIdentifier()); GetSystemIdentifier());
if (strcmp(primary_sysid, standby_sysid) != 0) if (strcmp(primary_sysid, standby_sysid) != 0)
{ {
primary_sysid = pstrdup(primary_sysid);
PQclear(res); PQclear(res);
ereport(ERROR, ereport(ERROR,
(errmsg("database system identifier differs between the primary and standby"), (errmsg("database system identifier differs between the primary and standby"),