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