ldap: fix resource leak - Mailing list pgsql-patches

From Neil Conway
Subject ldap: fix resource leak
Date
Msg-id 1162687417.5692.319.camel@localhost.localdomain
Whole thread Raw
Responses Re: ldap: fix resource leak  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Attached is a patch that fixes a minor error in CheckLDAPAuth() in 8.2:
when an LDAP handle is obtained via ldap_init(), it needs to be released
via ldap_unbind(). The code did this, but only if an error did not
occur.

I fixed this by adding the appropriate ldap_unbind() calls in error
control paths. An alternative would be to have a single place do the
error handling, and jump to that via goto. Anyone have any strong
feelings about which style is preferable here? I also didn't bother
checking the return value of ldap_unbind().

I also made a minor stylistic fix (use a "bool" for a boolean variable,
not an int).

Barring any objections, I'll apply this to HEAD tomorrow.

-Neil


Attachment

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: WIP patch for tuple freezing issues
Next
From: Tom Lane
Date:
Subject: Re: ldap: fix resource leak