Fix HTAB memory leaks

pull/6170/head
Marco Slot 2022-08-15 16:10:24 +02:00
parent c076fb72db
commit 6c73576606
3 changed files with 6 additions and 3 deletions

View File

@ -1281,7 +1281,8 @@ ErrorIfUnsupportedCascadeObjects(Oid relationId)
info.keysize = sizeof(Oid);
info.entrysize = sizeof(Oid);
info.hash = oid_hash;
uint32 hashFlags = (HASH_ELEM | HASH_FUNCTION);
info.hcxt = CurrentMemoryContext;
uint32 hashFlags = (HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
HTAB *nodeMap = hash_create("object dependency map (oid)", 64, &info, hashFlags);
bool unsupportedObjectInDepGraph =

View File

@ -2099,7 +2099,8 @@ GetDependingViews(Oid relationId)
info.keysize = sizeof(Oid);
info.entrysize = sizeof(ViewDependencyNode);
info.hash = oid_hash;
uint32 hashFlags = (HASH_ELEM | HASH_FUNCTION);
info.hcxt = CurrentMemoryContext;
uint32 hashFlags = (HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
HTAB *nodeMap = hash_create("view dependency map (oid)", 32, &info, hashFlags);
ViewDependencyNode *tableNode = BuildViewDependencyGraph(relationId, nodeMap);

View File

@ -2634,7 +2634,8 @@ ShardPlacementsListToHash(List *shardPlacementList)
info.entrysize = sizeof(ShardPlacement);
info.hash = PlacementsHashHashCode;
info.match = PlacementsHashCompare;
int hashFlags = (HASH_ELEM | HASH_FUNCTION | HASH_COMPARE);
info.hcxt = CurrentMemoryContext;
int hashFlags = (HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
HTAB *shardPlacementsHash = hash_create("ActivePlacements Hash",
shardPlacementCount, &info, hashFlags);