summaryrefslogtreecommitdiff
path: root/src/include/storage
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-03-07 13:25:11 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-03-07 13:29:24 +0200
commit4f91af8ca2f567bc9087644b29df8d6a56549994 (patch)
treee30007596f06ed347fd64d7332fb907c279ac386 /src/include/storage
parent8332fe76b559dd7d0a689ec66e96c359e67e1f3b (diff)
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.
Diffstat (limited to 'src/include/storage')
-rw-r--r--src/include/storage/smgr.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 98b6f131374..6e419f73653 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -80,6 +80,7 @@ extern void smgrinit(void);
extern SMgrRelation smgropen(RelFileNode rnode, BackendId backend);
extern bool smgrexists(SMgrRelation reln, ForkNumber forknum);
extern void smgrsetowner(SMgrRelation *owner, SMgrRelation reln);
+extern void smgrclearowner(SMgrRelation *owner, SMgrRelation reln);
extern void smgrclose(SMgrRelation reln);
extern void smgrcloseall(void);
extern void smgrclosenode(RelFileNodeBackend rnode);