Fix a memory leak in pg_ctl on config file contents
Fix a memory leak in pg_ctl on config file contents

Ensure to free the memory allocated via readfile(), per Gripe from
Coverity. This fix was cherrypicked from a larger upstream commit
fixing various Coverity defects, see commit message below.

Per Gripe from Coverity

  commit b1aebbb6a86e96d7b8f3035ac730dfc24652496c
  Author: Stephen Frost <sfrost@snowman.net>
  Date:   Sat Mar 1 22:14:14 2014 -0500

    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.

50wu/gpdb,cjcjameson/gpdb,adam8157/gpdb,kaknikhil/gpdb,janebeckman/gpdb,adam8157/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,xinzweb/gpdb,janebeckman/gpdb,lisakowen/gpdb,xinzweb/gpdb,edespino/gpdb,rvs/gpdb,xinzweb/gpdb,greenplum-db/gpdb,lintzc/gpdb,adam8157/gpdb,xinzweb/gpdb,lintzc/gpdb,edespino/gpdb,50wu/gpdb,50wu/gpdb,ashwinstar/gpdb,Quikling/gpdb,Chibin/gpdb,kaknikhil/gpdb,50wu/gpdb,janebeckman/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,lisakowen/gpdb,greenplum-db/gpdb,Quikling/gpdb,kaknikhil/gpdb,Quikling/gpdb,xinzweb/gpdb,kaknikhil/gpdb,edespino/gpdb,lintzc/gpdb,rvs/gpdb,Chibin/gpdb,Quikling/gpdb,Quikling/gpdb,cjcjameson/gpdb,rvs/gpdb,kaknikhil/gpdb,rvs/gpdb,rvs/gpdb,cjcjameson/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,lisakowen/gpdb,cjcjameson/gpdb,janebeckman/gpdb,lisakowen/gpdb,janebeckman/gpdb,yuanzhao/gpdb,rvs/gpdb,yuanzhao/gpdb,Quikling/gpdb,jmcatamney/gpdb,edespino/gpdb,janebeckman/gpdb,lisakowen/gpdb,lintzc/gpdb,Chibin/gpdb,Chibin/gpdb,Quikling/gpdb,edespino/gpdb,lintzc/gpdb,rvs/gpdb,jmcatamney/gpdb,lisakowen/gpdb,Chibin/gpdb,Quikling/gpdb,lintzc/gpdb,rvs/gpdb,jmcatamney/gpdb,adam8157/gpdb,janebeckman/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,Chibin/gpdb,ashwinstar/gpdb,lintzc/gpdb,janebeckman/gpdb,yuanzhao/gpdb,lintzc/gpdb,Chibin/gpdb,cjcjameson/gpdb,adam8157/gpdb,50wu/gpdb,Quikling/gpdb,greenplum-db/gpdb,edespino/gpdb,adam8157/gpdb,Quikling/gpdb,greenplum-db/gpdb,edespino/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,rvs/gpdb,adam8157/gpdb,jmcatamney/gpdb,janebeckman/gpdb,Chibin/gpdb,kaknikhil/gpdb,Chibin/gpdb,ashwinstar/gpdb,Chibin/gpdb,lintzc/gpdb,rvs/gpdb,yuanzhao/gpdb,edespino/gpdb,50wu/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,ashwinstar/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,kaknikhil/gpdb,edespino/gpdb,jmcatamney/gpdb,50wu/gpdb,xinzweb/gpdb,ashwinstar/gpdb,janebeckman/gpdb,jmcatamney/gpdb,cjcjameson/gpdb,lisakowen/gpdb,50wu/gpdb,xinzweb/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,edespino/gpdb,xinzweb/gpdb,cjcjameson/gpdb,lisakowen/gpdb,adam8157/gpdb,cjcjameson/gpdb