I wrote:
> ... Not sure that
> this is actually a net win though, as a PANIC might well be considered a
> worse problem than a one-time leak of some LDAP state.
Come to think of it: either elog(ERROR) or a failure return from
CheckLDAPAuth is going to lead directly to backend exit, so the
whole thing is pretty much a cosmetic issue anyway. I don't object
to adding the ldap_unbind calls, but I'd not recommend adding a large
pile of code.
regards, tom lane