postgres.git / summary / log / commit / refs
commit d213f3114d9901159b41cc72f9fd41c74bd2b2b6
Author: Peter Eisentraut <peter@eisentraut.org>
Date: Wed Nov 06 13:20:29 2019 +0000
First released in: 13.0, 10.11, 11.6, 12.1
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 <jgdr@dalibo.com>
Discussion: https://www.postgresql.org/message-id/20191105172918.3e32a446@firost
src/backend/replication/logical/relation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c
index 905ca12fd80..bc0e64713c0 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -267,7 +267,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode)
*/
desc = RelationGetDescr(entry->localrel);
oldctx = MemoryContextSwitchTo(LogicalRepRelMapContext);
- entry->attrmap = palloc(desc->natts * sizeof(int));
+ entry->attrmap = palloc(desc->natts * sizeof(AttrNumber));
MemoryContextSwitchTo(oldctx);
found = 0;
[parent: cb6d7f9855e9]