]> granicus.if.org Git - postgresql/commit
Fix dangling smgr_owner pointer when a fake relcache entry is freed.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 7 Mar 2014 11:25:11 +0000 (13:25 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Fri, 7 Mar 2014 11:29:49 +0000 (13:29 +0200)
commit080ad9120d79933e5aed545986885058f8aa7385
tree922e25b81525dd748f13f914c408609919f08f0f
parentc7a186e392d4654148a45eaf8ffbf026553ecbdb
Fix dangling smgr_owner pointer when a fake relcache entry is freed.

A fake relcache entry can "own" a SmgrRelation object, like a regular
relcache entry. But when it was free'd, the owner field in SmgrRelation
was not cleared, so it was left pointing to free'd memory.

Amazingly this apparently hasn't caused crashes in practice, or we would've
heard about it earlier. Andres found this with Valgrind.

Report and fix by Andres Freund, with minor modifications by me. Backpatch
to all supported versions.
src/backend/access/transam/xlogutils.c
src/backend/storage/smgr/smgr.c
src/include/storage/smgr.h