diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-06 21:53:18 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-06 21:53:18 +0000 |
commit | e69b8d46559bee74b63917414320a7dcbdfd3fe5 (patch) | |
tree | 871a0ce5a230cf98bc424e4e963df4387dd1332e /src/backend/utils/cache/relcache.c | |
parent | ca882439526154cdfa8745019f8adfeb2ad48489 (diff) | |
download | postgresql-e69b8d46559bee74b63917414320a7dcbdfd3fe5.tar.gz postgresql-e69b8d46559bee74b63917414320a7dcbdfd3fe5.zip |
Fix memory leak in relcache handling of rules: allocate rule parsetrees
in per-entry sub-memory-context, where they were supposed to go, rather
than in CacheMemoryContext where the code was putting them. Must've
suffered a severe brain fade when I wrote this :-(
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r-- | src/backend/utils/cache/relcache.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 963818ffd9b..f3ca1903db9 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.124 2001/01/06 01:48:59 inoue Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.125 2001/01/06 21:53:18 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -881,7 +881,7 @@ RelationBuildRuleLock(Relation relation) Assert(! isnull); ruleaction_str = DatumGetCString(DirectFunctionCall1(textout, ruleaction)); - oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + oldcxt = MemoryContextSwitchTo(rulescxt); rule->actions = (List *) stringToNode(ruleaction_str); MemoryContextSwitchTo(oldcxt); pfree(ruleaction_str); @@ -893,7 +893,7 @@ RelationBuildRuleLock(Relation relation) Assert(! isnull); rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout, rule_evqual)); - oldcxt = MemoryContextSwitchTo(CacheMemoryContext); + oldcxt = MemoryContextSwitchTo(rulescxt); rule->qual = (Node *) stringToNode(rule_evqual_str); MemoryContextSwitchTo(oldcxt); pfree(rule_evqual_str); |