From af7e90a2778625d63add69165fb68c370509a199 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Sun, 7 Apr 2024 19:00:11 -0700 Subject: [PATCH] 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 Reported-by: Coverity Discussion: https://postgr.es/m/3005248.1712538233@sss.pgh.pa.us Backpatch: 12- --- src/include/lib/simplehash.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 37d8d17655..3e1b1f9461 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);