aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-09-28 11:19:46 -0400
committerRobert Haas <rhaas@postgresql.org>2016-09-28 11:22:39 -0400
commit32841fa325de298e0bad771c588354fd59866e42 (patch)
treec118893d2a6d25720ef230d0512bf6a53d956d12 /src
parentf0631bda9bf729161490da76414648dafcc0adbe (diff)
downloadpostgresql-32841fa325de298e0bad771c588354fd59866e42.tar.gz
postgresql-32841fa325de298e0bad771c588354fd59866e42.zip
Fix dangling pointer problem in ReorderBufferSerializeChange.
Commit 3fe3511d05127cc024b221040db2eeb352e7d716 introduced a new case into this function, but neglected to ensure that the "ondisk" pointer got updated after a possible reallocation as the code does in other cases. Stas Kelvich, per diagnosis by Konstantin Knizhnik.
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/logical/reorderbuffer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 43b584cf7e2..0fdb7fb8f73 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2252,6 +2252,9 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
data = ((char *) rb->outbuf) + sizeof(ReorderBufferDiskChange);
+ /* might have been reallocated above */
+ ondisk = (ReorderBufferDiskChange *) rb->outbuf;
+
/* write the prefix including the size */
memcpy(data, &prefix_size, sizeof(Size));
data += sizeof(Size);