Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d40abd5

Browse files
committed
Fix memory allocation mistake
The previous code was allocating more memory than necessary because the formula used the wrong data type. Reported-by: Jehan-Guillaume de Rorthais <[email protected]> Discussion: https://www.postgresql.org/message-id/20191105172918.3e32a446@firost
1 parent 5b7ba75 commit d40abd5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/replication/logical/relation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
267267
*/
268268
desc = RelationGetDescr(entry->localrel);
269269
oldctx = MemoryContextSwitchTo(LogicalRepRelMapContext);
270-
entry->attrmap = palloc(desc->natts * sizeof(int));
270+
entry->attrmap = palloc(desc->natts * sizeof(AttrNumber));
271271
MemoryContextSwitchTo(oldctx);
272272

273273
found = 0;

0 commit comments

Comments
 (0)