Re: freeing LDAPMessage in CheckLDAPAuth - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: freeing LDAPMessage in CheckLDAPAuth
Date
Msg-id YxQ6RgYc3GzV9ndd@paquier.xyz
Whole thread Raw
In response to freeing LDAPMessage in CheckLDAPAuth  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: freeing LDAPMessage in CheckLDAPAuth
List pgsql-hackers
On Sat, Sep 03, 2022 at 05:00:30PM -0700, Zhihong Yu wrote:
>        Note  that  *res*  parameter  of  *ldap*_*search*_*ext*_*s()*
> and *ldap*_*search*_*s()*
>        should be freed with *ldap*_*msgfree()* regardless of return
> value of these
>        functions.
>
> Please see the attached patch which frees the search_message in the above case.

Yep, nice catch, I am reading the same thing as you do.  I can see
that we already do that after a failing ldap_search_st() call in
fe-connect.c for libpq.  Hence, similarly, we'd better call
ldap_msgfree() on search_message when it is not NULL after a search
failure, no?  The patch you are proposing does not do that.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_basebackup's --gzip switch misbehaves
Next
From: Michael Paquier
Date:
Subject: Re: json docs fix jsonb_path_exists_tz again