From: Robert Haas Date: Thu, 7 Jan 2010 20:39:45 +0000 (+0000) Subject: Document why we copy reloptions into CacheMemoryContext after-the-fact. X-Git-Url: http://git.postgresql.org/gitweb/delmail?a=commitdiff_plain;h=28df36faa35190dc74e672900efa6eeb7873172d;p=users%2Fandresfreund%2Fpostgres.git Document why we copy reloptions into CacheMemoryContext after-the-fact. --- diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 8d31835055..ccb8ae1f34 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -404,7 +404,12 @@ RelationParseRelOptions(Relation relation, HeapTuple tuple) relation->rd_rel->relkind == RELKIND_INDEX ? relation->rd_am->amoptions : InvalidOid); - /* Copy parsed data into CacheMemoryContext */ + /* + * Copy parsed data into CacheMemoryContext. To guard against the + * possibility of leaks in the reloptions code, we want to do the actual + * parsing in the caller's memory context and copy the results into + * CacheMemoryContext after the fact. + */ if (options) { relation->rd_options = MemoryContextAlloc(CacheMemoryContext,