Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 32841fa

Browse files
committed
Fix dangling pointer problem in ReorderBufferSerializeChange.
Commit 3fe3511 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.
1 parent f0631bd commit 32841fa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/replication/logical/reorderbuffer.c

+3
Original file line numberDiff line numberDiff line change
@@ -2252,6 +2252,9 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
22522252

22532253
data = ((char *) rb->outbuf) + sizeof(ReorderBufferDiskChange);
22542254

2255+
/* might have been reallocated above */
2256+
ondisk = (ReorderBufferDiskChange *) rb->outbuf;
2257+
22552258
/* write the prefix including the size */
22562259
memcpy(data, &prefix_size, sizeof(Size));
22572260
data += sizeof(Size);

0 commit comments

Comments
 (0)