Fix memory leak in ListToHashSet

pull/1574/head
Marco Slot 2017-11-22 11:20:26 +01:00
parent f4ceea5a3d
commit 20a526d5c4
1 changed files with 2 additions and 1 deletions

View File

@ -121,7 +121,7 @@ ListToHashSet(List *itemList, Size keySize, bool isStringList)
HASHCTL info;
HTAB *itemSet = NULL;
ListCell *itemCell = NULL;
int flags = HASH_ELEM;
int flags = HASH_ELEM | HASH_CONTEXT;
/* allocate sufficient capacity for O(1) expected look-up time */
int capacity = (int) (list_length(itemList) / 0.75) + 1;
@ -130,6 +130,7 @@ ListToHashSet(List *itemList, Size keySize, bool isStringList)
memset(&info, 0, sizeof(info));
info.keysize = keySize;
info.entrysize = keySize;
info.hcxt = CurrentMemoryContext;
if (!isStringList)
{