Re: Coverity complains about simplehash.h's SH_STAT() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Coverity complains about simplehash.h's SH_STAT()
Date
Msg-id 3011033.1712540483@sss.pgh.pa.us
Whole thread Raw
In response to Re: Coverity complains about simplehash.h's SH_STAT()  (Andres Freund <andres@anarazel.de>)
Responses Re: Coverity complains about simplehash.h's SH_STAT()
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2024-04-07 21:03:53 -0400, Tom Lane wrote:
>> I realize this function is only debug support, but wouldn't it
>> be appropriate to pfree(collisions) before exiting?

> It indeed looks like that memory should be freed. Very odd that coverity
> started to complain about that just now.  If coverity had started to complain
> after da41d71070d, I'd understand, but that was ~5 years ago.

If we recently added a new simplehash caller, Coverity might see that
as a new bug.  Still doesn't explain why nothing about the old callers.
We might have over-hastily dismissed such warnings as uninteresting,
perhaps.

> I can't see a way it could hurt in the back branches, so I'm inclined to
> backpatch the pfree?

+1

            regards, tom lane



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Experiments with Postgres and SSL
Next
From: Tom Lane
Date:
Subject: Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan