aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-08-24 22:20:01 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-08-24 22:20:25 -0400
commitae4760d667c71924932ab32e14996b5be1831fc6 (patch)
treedcf8880156f15678b8656257986456bd7bf374be
parentca9cb940d23dc8869a635fa27a08e60837b17c07 (diff)
downloadpostgresql-ae4760d667c71924932ab32e14996b5be1831fc6.tar.gz
postgresql-ae4760d667c71924932ab32e14996b5be1831fc6.zip
Fix small query-lifespan memory leak in bulk updates.
When there is an identifiable REPLICA IDENTITY index on the target table, heap_update leaks the id_attrs bitmapset. That's not many bytes, but it adds up over enough rows, since the code typically runs in a query-lifespan context. Bug introduced in commit e55704d8b, which did a rather poor job of cloning the existing use-pattern for RelationGetIndexAttrBitmap(). Per bug #14293 from Zhou Digoal. Back-patch to 9.4 where the bug was introduced. Report: <20160824114320.15676.45171@wrigleys.postgresql.org>
-rw-r--r--src/backend/access/heap/heapam.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index c63dfa0bafc..6a27ef41400 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -3802,6 +3802,7 @@ l2:
ReleaseBuffer(vmbuffer);
bms_free(hot_attrs);
bms_free(key_attrs);
+ bms_free(id_attrs);
return result;
}
@@ -4268,6 +4269,7 @@ l2:
bms_free(hot_attrs);
bms_free(key_attrs);
+ bms_free(id_attrs);
return HeapTupleMayBeUpdated;
}