[PATCH] Fix use of free in walsender error handling after a sysid mismatch.
Started by Andres Freundover 11 years ago2 messages
Hi,
Walsender does a PQClear(con) but then accesses data acquired with
PQgetvalue(). That's clearly not ok.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachments:
0001-Fix-use-of-free-in-walsender-error-handling-after-a-.patchtext/x-patch; charset=us-asciiDownload
>From 1b7df22ff6da40ad4fcfa4eeacc1822373baa4e6 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 5 May 2014 18:03:44 +0200
Subject: [PATCH] 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.
---
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 96f31c4..88d27c7 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"),
--
1.8.5.rc2.dirty
Re: [PATCH] Fix use of free in walsender error handling after a sysid mismatch.
On 05/05/2014 07:14 PM, Andres Freund wrote:
Hi,
Walsender does a PQClear(con) but then accesses data acquired with
PQgetvalue(). That's clearly not ok.
Fixed, thanks!
- Heikki
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers