Re: Clang 3.3 Analyzer Results

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, "noloader(at)gmail(dot)com" <noloader(at)gmail(dot)com>, Tomas Vondra <tv(at)fuzzy(dot)cz>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clang 3.3 Analyzer Results
Date: 2013-11-20 03:03:31
Message-ID: 1384916611.13670.2.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, 2013-11-13 at 12:43 -0500, Tom Lane wrote:
> Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> > If nobody objects, I'll fix that small memory leak in the
> > regression test driver. Hopefully someone more familiar with
> > pg_basebackup will fix the double-free (and related problems
> > mentioned by Tom) in streamutil.c.
>
> Here's a less convoluted (IMHO) approach to the password management logic
> in streamutil.c. One thing I really didn't care for about the existing
> coding is that the loop-for-password included all the rest of the
> function, even though there's no intention to retry for any purpose except
> collecting a password. So I moved up the bottom of the loop. For ease of
> review, I've not reindented the code below the new loop bottom, but would
> do so before committing.
>
> Any objections to this version?

As far as the clang static analyzer is concerned, this hasn't actually
helped, because now it's complaining about

Value stored to 'need_password' is never read

With the attached patch, that warning goes way, and the logic is
arguably slightly clearer, too.

Attachment Content-Type Size
need_password.patch text/x-patch 616 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2013-11-20 03:30:10 Re: Postgres as In-Memory Database?
Previous Message Kevin Wooten 2013-11-20 01:33:54 Scrolling/Updating Cursors

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2013-11-20 03:21:47 Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block
Previous Message Jeff Frost 2013-11-20 00:10:45 Re: Data corruption issues using streaming replication on 9.0.14/9.2.5/9.3.1