Commit eea65943 authored by Robert Haas's avatar Robert Haas

Fix memory leaks in event trigger code.

Spotted by Jeff Davis.
parent ac78c417
......@@ -84,7 +84,7 @@ BuildEventTriggerCache(void)
* the cache failed, then there might be some junk lying around
* that we want to reclaim.
*/
MemoryContextReset(EventTriggerCacheContext);
MemoryContextResetAndDeleteChildren(EventTriggerCacheContext);
}
else
{
......@@ -119,8 +119,9 @@ BuildEventTriggerCache(void)
ctl.keysize = sizeof(EventTriggerEvent);
ctl.entrysize = sizeof(EventTriggerCacheEntry);
ctl.hash = tag_hash;
ctl.hcxt = EventTriggerCacheContext;
cache = hash_create("Event Trigger Cache", 32, &ctl,
HASH_ELEM | HASH_FUNCTION);
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
/*
* Prepare to scan pg_event_trigger in name order. We use an MVCC
......@@ -237,6 +238,6 @@ DecodeTextArrayToCString(Datum array, char ***cstringp)
static void
InvalidateEventCacheCallback(Datum arg, int cacheid, uint32 hashvalue)
{
MemoryContextReset(EventTriggerCacheContext);
MemoryContextResetAndDeleteChildren(EventTriggerCacheContext);
EventTriggerCache = NULL;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment