diff options
author | Andres Freund <andres@anarazel.de> | 2024-04-07 19:00:11 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2024-04-07 19:09:08 -0700 |
commit | 4b179a47242993fe48b1bfa21b17dc9d5e2b35a2 (patch) | |
tree | 5bb7da274fbcce6dce4331d91bec73a906c77f68 /src | |
parent | 0d95711ae0d3b328b0a3534a546a4f848d273e08 (diff) | |
download | postgresql-4b179a47242993fe48b1bfa21b17dc9d5e2b35a2.tar.gz postgresql-4b179a47242993fe48b1bfa21b17dc9d5e2b35a2.zip |
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 <tgl@sss.pgh.pa.us>
Reported-by: Coverity
Discussion: https://postgr.es/m/3005248.1712538233@sss.pgh.pa.us
Backpatch: 12-
Diffstat (limited to 'src')
-rw-r--r-- | src/include/lib/simplehash.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 145d9db50ec..6c3b96fd549 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -909,6 +909,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); |