pgsql: Fix minor memory leak in ident_inet().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix minor memory leak in ident_inet().
Date: 2015-02-12 00:10:06
Message-ID: E1YLhM6-0002H5-Rl@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix minor memory leak in ident_inet().

We'd leak the ident_serv data structure if the second pg_getaddrinfo_all
(the one for the local address) failed. This is not of great consequence
because a failure return here just leads directly to backend exit(), but
if this function is going to try to clean up after itself at all, it should
not have such holes in the logic. Try to fix it in a future-proof way by
having all the failure exits go through the same cleanup path, rather than
"optimizing" some of them.

Per Coverity. Back-patch to 9.2, which is as far back as this patch
applies cleanly.

Branch
------
REL9_3_STABLE

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

Modified Files
--------------
src/backend/libpq/auth.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-02-12 00:21:00 pgsql: Fix missing PQclear() in libpqrcv_endstreaming().
Previous Message Tom Lane 2015-02-11 23:35:54 pgsql: Fix more memory leaks in failure path in buildACLCommands.