mirror of https://github.com/citusdata/citus.git
Fix memory leak in ListToHashSet
parent
f4ceea5a3d
commit
20a526d5c4
|
@ -121,7 +121,7 @@ ListToHashSet(List *itemList, Size keySize, bool isStringList)
|
||||||
HASHCTL info;
|
HASHCTL info;
|
||||||
HTAB *itemSet = NULL;
|
HTAB *itemSet = NULL;
|
||||||
ListCell *itemCell = NULL;
|
ListCell *itemCell = NULL;
|
||||||
int flags = HASH_ELEM;
|
int flags = HASH_ELEM | HASH_CONTEXT;
|
||||||
|
|
||||||
/* allocate sufficient capacity for O(1) expected look-up time */
|
/* allocate sufficient capacity for O(1) expected look-up time */
|
||||||
int capacity = (int) (list_length(itemList) / 0.75) + 1;
|
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));
|
memset(&info, 0, sizeof(info));
|
||||||
info.keysize = keySize;
|
info.keysize = keySize;
|
||||||
info.entrysize = keySize;
|
info.entrysize = keySize;
|
||||||
|
info.hcxt = CurrentMemoryContext;
|
||||||
|
|
||||||
if (!isStringList)
|
if (!isStringList)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue