Re: freeing LDAPMessage in CheckLDAPAuth

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: freeing LDAPMessage in CheckLDAPAuth
Date: 2022-09-04 05:40:22
Message-ID: YxQ6RgYc3GzV9ndd@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-09-04 05:40:58 Re: json docs fix jsonb_path_exists_tz again
Previous Message Michael Paquier 2022-09-04 05:20:52 Re: pg_basebackup's --gzip switch misbehaves