[Freeipa-devel] [PATCH 0088] Don't error when find_base() fails if a base is not required

Martin Basti mbasti at redhat.com
Mon Jan 11 17:05:39 UTC 2016



On 11.01.2016 17:52, Nathaniel McCallum wrote:
> On Mon, 2016-01-11 at 17:45 +0100, Martin Basti wrote:
>>
>> On 14.12.2015 16:22, Nathaniel McCallum wrote:
>>> We always have to call find_base() in order to force libldap to
>>> open
>>> the socket. However, if no base is actually required then there is
>>> no reason to error out if find_base() fails. This condition can
>>> arise
>>> when anonymous binds are disabled.
>>>
>>>
>> Hello,
>>
>> IMO this code may result into free(NULL);
>>
>>      /* Always find the base since this forces open the socket. */
>>      basetmp = find_base(ldp);
>>      if (base != NULL) {
>>          if (basetmp == NULL)
>>              return ENOTCONN;
>>          *base = basetmp;
>>      } else {
>>          free(basetmp);  <-- here, if both base and basetmp are NULL
>>      }
>  From the man page for free(): "If ptr is NULL, no operation is
> performed."
>
> Nathaniel
Sorry, my bad.

ACK




More information about the Freeipa-devel mailing list