10000 Avoid memory leak on deletion from uint64 list · postgrespro/aqo@41cf245 · GitHub
[go: up one dir, main page]

Skip to content

Commit 41cf245

Browse files
author
Alena Rybakina
committed
Avoid memory leak on deletion from uint64 list
1 parent 3e99fda commit 41cf245

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hash.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ get_grouped_exprs_hash(int child_fss, List *group_exprs)
176176

177177
final_hashes[0] = child_fss;
178178
final_hashes[1] = get_int_array_hash(hashes, i);
179+
180+
pfree(hashes);
181+
179182
return get_int_array_hash(final_hashes, 2);
180183
}
181184

@@ -475,6 +478,7 @@ get_relations_hash(List *relsigns)
475478
int nhashes = 0;
476479
int64 *hashes = palloc(list_length(relsigns) * sizeof(uint64));
477480
ListCell *lc;
481+
int64 result;
478482

479483
foreach(lc, relsigns)
480484
{
@@ -485,8 +489,12 @@ get_relations_hash(List *relsigns)
485489
qsort(hashes, nhashes, sizeof(int64), int64_compare);
486490

487491
/* Make a final hash value */
488-
return DatumGetInt64(hash_any_extended((const unsigned char *) hashes,
492+
493+
result = DatumGetInt64(hash_any_extended((const unsigned char *) hashes,
489494
nhashes * sizeof(int64), 0));
495+
496+
pfree(hashes);
497+
return result;
490498
}
491499

492500
/*

0 commit comments

Comments
 (0)
0