Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4b179a4

Browse files
committed
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-
1 parent 0d95711 commit 4b179a4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/include/lib/simplehash.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,9 @@ SH_STAT(SH_TYPE * tb)
909909
max_collisions = curcoll;
910910
}
911911

912+
/* large enough to be worth freeing, even if just used for debugging */
913+
pfree(collisions);
914+
912915
if (tb->members > 0)
913916
{
914917
fillfactor = tb->members / ((double) tb->size);

0 commit comments

Comments
 (0)