]> granicus.if.org Git - postgresql/commitdiff
Fix wrong allocation size in c8f621c43.
authorAndres Freund <andres@anarazel.de>
Mon, 7 Mar 2016 00:27:20 +0000 (16:27 -0800)
committerAndres Freund <andres@anarazel.de>
Mon, 7 Mar 2016 00:27:20 +0000 (16:27 -0800)
In c8f621c43 I forgot to account for MAXALIGN when allocating a new
tuplebuf in ReorderBufferGetTupleBuf(). That happens to currently not
cause active problems on a number of platforms because the affected
pointer is already aligned, but others, like ppc and hppa, trigger this
in the regression test, due to a debug memset clearing memory.

Fix that.

Backpatch: 9.4, like the previous commit.

src/backend/replication/logical/reorderbuffer.c

index 570400ffb736aae75927f8286e9e965391539a31..e2ad4728cdc6932ec15cf91f6b7c6247aadd0fca 100644 (file)
@@ -483,7 +483,8 @@ ReorderBufferGetTupleBuf(ReorderBuffer *rb, Size tuple_len)
        {
                tuple = (ReorderBufferTupleBuf *)
                        MemoryContextAlloc(rb->context,
-                                                          sizeof(ReorderBufferTupleBuf) + alloc_len);
+                                                          sizeof(ReorderBufferTupleBuf) +
+                                                          MAXIMUM_ALIGNOF + alloc_len);
                tuple->alloc_tuple_size = alloc_len;
                tuple->tuple.t_data = ReorderBufferTupleBufData(tuple);
        }