Re: freeing LDAPMessage in CheckLDAPAuth
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2022-09-04T05:40:22Z
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
Commits
-
Free correctly LDAPMessage returned by ldap_search_s() in auth.c
- 799437e0bd32 16.0 landed