Re: [GENERAL] Clang 3.3 Analyzer Results

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
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 14:35:26
Message-ID: 945.1384439726@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> 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/.

Hm, maybe, but where? It's inappropriate for libpgcommon (we don't
want that calling libpq), so I'm not real sure what to do with it.
Also it's not clear to me that all these tools would have the same
requirements for the non-password parameters for the connection request.

BTW, I realized while fooling with this that although the code looks like
it's intended to iterate till a correct password is obtained, actually it
cannot prompt more than once, because of the way PQconnectionNeedsPassword
is coded. Therefore, the double free that clang is worried about can't
really happen. It's still worth fixing IMO.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan M 2013-11-14 14:48:15 Re: Tuning 9.3 for 32 GB RAM
Previous Message Alexander Farber 2013-11-14 13:44:00 Tuning 9.3 for 32 GB RAM

Browse pgsql-hackers by date

  From Date Subject
Next Message Garick Hamlin 2013-11-14 14:47:08 Re: additional json functionality
Previous Message Andres Freund 2013-11-14 14:33:39 Re: init_sequence spill to hash table