summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Freund2024-04-08 02:00:11 +0000
committerAndres Freund2024-04-08 02:08:41 +0000
commitaf7e90a2778625d63add69165fb68c370509a199 (patch)
treec607a574b3583aa4eb31beea75d22b2ed09dea0c
parent3e60e956b0017ae9d329bf242e76c4487fb39b4d (diff)
simplehash: Free collisions array in SH_STAT
While SH_STAT() is only used for debugging, the allocated array can be large, and therefore should be freed. It's unclear why coverity started warning now. Reported-by: Tom Lane <[email protected]> Reported-by: Coverity Discussion: https://postgr.es/m/[email protected] Backpatch: 12-
-rw-r--r--src/include/lib/simplehash.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index 37d8d17655b..3e1b1f94616 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -1119,6 +1119,9 @@ SH_STAT(SH_TYPE * tb)
max_collisions = curcoll;
}
+ /* large enough to be worth freeing, even if just used for debugging */
+ pfree(collisions);
+
if (tb->members > 0)
{
fillfactor = tb->members / ((double) tb->size);