Re: Two coverity non-bugs - Mailing list pgsql-patches

From Tom Lane
Subject Re: Two coverity non-bugs
Date
Msg-id 25867.1145457141@sss.pgh.pa.us
Whole thread Raw
In response to Two coverity non-bugs  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Two coverity non-bugs  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-patches
Martijn van Oosterhout <kleptog@svana.org> writes:
> Attached is a patch that fixes two non-bugs. There's plenty of
> redundant NULL checks around the place but these were just so silly I
> figure they're worth fixing.

> The first checks 'file' the line after having dereferenced it. The
> second checks 'currSchema' where the code is designed to never allow it
> to be NULL.

The first patch looks reasonable but I object to the second.  Coverity
is not going to dictate coding conventions to us --- it is not *nearly*
bright enough for that.  In this case, the code is locally allowing for
the possibility that AH->currSchema was NULL, and I don't consider it
good style to remove that allowance.  (I take it BTW that this allegedly
bulletproof tool fails to consider the possibility that strdup fails
and returns NULL ...)

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] bug in windows xp
Next
From: Martijn van Oosterhout
Date:
Subject: Re: [BUGS] bug in windows xp