freeing LDAPMessage in CheckLDAPAuth

From: Zhihong Yu <zyu(at)yugabyte(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: freeing LDAPMessage in CheckLDAPAuth
Date: 2022-09-04 00:00:30
Message-ID: CALNJ-vTf5Y+8RtzZ4GjOGE9qWVHZ8awfhnFYc_qGm8fMLUNRAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
In CheckLDAPAuth(), around line 2606:

if (r != LDAP_SUCCESS)
{
ereport(LOG,
(errmsg("could not search LDAP for filter \"%s\" on
server \"%s\": %s",

It seems that the call to ldap_msgfree() is missing in the above case.
According to
https://www.openldap.org/software//man.cgi?query=ldap_search_s&sektion=3&apropos=0&manpath=OpenLDAP+2.4-Release
:

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.

Thanks

Attachment Content-Type Size
ldap-msg-free.patch application/octet-stream 338 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2022-09-04 02:32:49 Re: warning: comparison of integer expressions of different signedness related to simd.h
Previous Message Daniel Gustafsson 2022-09-03 22:39:20 Re: Fix typo function circle_same (src/backend/utils/adt/geo_ops.c)