]> 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:28:52 +0000 (13:28 +0200)
commit55566c9a740144439b54ff3aacbd43d11b6de52f
tree1dfb40a4420d915c74b0b755e6db6021f31f4b85
parentad7b48ea08d6c33bae0a33c5f2a06272293c0f2f
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