mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
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 :-(
This commit is contained in:
6
src/backend/utils/cache/relcache.c
vendored
6
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
Assert(! isnull);
|
||||||
ruleaction_str = DatumGetCString(DirectFunctionCall1(textout,
|
ruleaction_str = DatumGetCString(DirectFunctionCall1(textout,
|
||||||
ruleaction));
|
ruleaction));
|
||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(rulescxt);
|
||||||
rule->actions = (List *) stringToNode(ruleaction_str);
|
rule->actions = (List *) stringToNode(ruleaction_str);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
pfree(ruleaction_str);
|
pfree(ruleaction_str);
|
||||||
@ -893,7 +893,7 @@ RelationBuildRuleLock(Relation relation)
|
|||||||
Assert(! isnull);
|
Assert(! isnull);
|
||||||
rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
|
rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
|
||||||
rule_evqual));
|
rule_evqual));
|
||||||
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
|
oldcxt = MemoryContextSwitchTo(rulescxt);
|
||||||
rule->qual = (Node *) stringToNode(rule_evqual_str);
|
rule->qual = (Node *) stringToNode(rule_evqual_str);
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
pfree(rule_evqual_str);
|
pfree(rule_evqual_str);
|
||||||
|
Reference in New Issue
Block a user