summaryrefslogtreecommitdiff
path: root/src/include/storage/smgr.h
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:43:28 +0200
commitd411d6eff1b7e91de0fecece08acc6b6eca04d6d (patch)
tree7526ef4f87c6d66d29aa2184bf6e563bf9d26a93 /src/include/storage/smgr.h
parentff9d757c67786b389f19abc3187d158adda500d8 (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/smgr.h')
-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 1761f1c8089..957f2108d54 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -62,6 +62,7 @@ extern void smgrinit(void);
extern SMgrRelation smgropen(RelFileNode rnode);
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(RelFileNode rnode);