pgsql: Various Coverity-spotted fixes - Mailing list pgsql-committers

From Stephen Frost
Subject pgsql: Various Coverity-spotted fixes
Date
Msg-id E1WJwrL-0005U3-LA@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Various Coverity-spotted fixes  (Bruce Momjian <bruce@momjian.us>)
List pgsql-committers
Various Coverity-spotted fixes

A number of issues were identified by the Coverity scanner and are
addressed in this patch.  None of these appear to be security issues
and many are mostly cosmetic changes.

Short comments for each of the changes follows.

Correct the semi-colon placement in be-secure.c regarding SSL retries.
Remove a useless comparison-to-NULL in proc.c (value is dereferenced
  prior to this check and therefore can't be NULL).
Add checking of chmod() return values to initdb.
Fix a couple minor memory leaks in initdb.
Fix memory leak in pg_ctl- involves free'ing the config file contents.
Use an int to capture fgetc() return instead of an enum in pg_dump.
Fix minor memory leaks in pg_dump.
  (note minor change to convertOperatorReference()'s API)
Check fclose()/remove() return codes in psql.
Check fstat(), find_my_exec() return codes in psql.
Various ECPG memory leak fixes.
Check find_my_exec() return in ECPG.
Explicitly ignore pqFlush return in libpq error-path.
Change PQfnumber() to avoid doing an strdup() when no changes required.
Remove a few useless check-against-NULL's (value deref'd beforehand).
Check rmtree(), malloc() results in pg_regress.
Also check get_alternative_expectfile() return in pg_regress.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/b1aebbb6a86e96d7b8f3035ac730dfc24652496c

Modified Files
--------------
src/backend/libpq/be-secure.c          |    2 +-
src/backend/storage/lmgr/proc.c        |    3 +-
src/bin/initdb/initdb.c                |   36 +++++++++++++--
src/bin/pg_ctl/pg_ctl.c                |   34 ++++++++++++++
src/bin/pg_dump/pg_backup_archiver.c   |    4 +-
src/bin/pg_dump/pg_dump.c              |   79 ++++++++++++++++++++++----------
src/bin/psql/command.c                 |   12 +++--
src/bin/psql/copy.c                    |   15 ++++--
src/bin/psql/startup.c                 |    7 ++-
src/interfaces/ecpg/ecpglib/execute.c  |   27 +++++++++--
src/interfaces/ecpg/preproc/ecpg.c     |    6 ++-
src/interfaces/ecpg/preproc/type.c     |   76 ++++++++++++++++++++++--------
src/interfaces/ecpg/preproc/variable.c |    5 +-
src/interfaces/libpq/fe-connect.c      |    2 +-
src/interfaces/libpq/fe-exec.c         |   28 +++++++++--
src/test/regress/pg_regress.c          |   27 ++++++++++-
16 files changed, 290 insertions(+), 73 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Allow regex operations to be terminated early by query cancel re
Next
From: Stephen Frost
Date:
Subject: pgsql: Another round of Coverity fixes