Re: [GENERAL] Clang 3.3 Analyzer Results

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kevin Grittner <kgrittn(at)ymail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, 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: [GENERAL] Clang 3.3 Analyzer Results
Date: 2013-11-14 10:45:52
Message-ID: CABUevEyp6YgMHkrGBdN=TTFfwaHnYGxkBJwPVtiNsos++MZnKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wednesday, November 13, 2013, Tom Lane wrote:

> Kevin Grittner <kgrittn(at)ymail(dot)com <javascript:;>> 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?
>
> Nope, looks good to me.

That code was originally "stolen" from psql, and then whacked around a
number of times. The part about looping and passwords, for example, is in
startup.c in psql as well. We probably want to fix it there as well (even
if it doesn't have the same problem, it has the same general design). Or
perhaps even put that function somewhere shared between the two?

It's also in pg_dump/pg_backup_db.c, there's a version of it in
pg_dumpall.c, etc. Which I think is a good argument for fixing them all by
sharing the code somewhere? In fact, we already have some in
script/common.c - but it's only used by the tools that are in script/.

//Magnus

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message LPlateAndy 2013-11-14 10:59:49 Re: expression index not used within function
Previous Message walerina 2013-11-14 09:46:41 Re: How to print out a mass of text messages from a Samsung smart phone easily?

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2013-11-14 10:45:56 Re: [PATCH 1/2] SSL: GUC option to prefer server cipher order
Previous Message Sameer Thakur 2013-11-14 10:41:03 Re: Extra functionality to createuser