Re: Do I need to ldap_memfree after ldap_get_lderrno? SDK docs say yes.
Rich Megginson <[email protected]> Thu, 27 Aug 2009 11:01:01 -0600
| Newsgroups | gmane.comp.mozilla.devel.directory |
|---|---|
| Message-ID | <[email protected]> |
Matthew M. DeLoera wrote:
> Rich Megginson wrote:
>> Matthew M. DeLoera wrote:
>>> Some basic questions about ldap_get_lderrno:
>>>
>>> - Do I have to call ldap_memfree for either *m or *s? Code example
>>> 5-6 in the SDK documentation calls ldap_memfree to release the error
>>> string after printing it. Do I have to call it for both?
>>
>> Eek - that's bad. You should not free those pointers. Here is the
>> actual code:
>> if ( m != NULL ) {
>> *m = ld->ld_matched;
>> }
>> if ( s != NULL ) {
>> *s = ld->ld_error;
>> }
>> return( ld->ld_errno );
>>
>> It returns pointers to the internal data structures - you should never
>> call free on these pointers.
>>
>> Can you point me to the documentation you referred to?
> Hi Rich! Yes - code example 5-6:
>
> - Go to chapter 18 (function reference).
> - Jump to ldap_get_lderrno().
> - Jump to "Getting Information About the Error".
> - Scroll down the page to Code Example 5-6. ldap_memfree() is being
> called on the error message pointer.
>
I don't see that. I'm looking here -
http://www.mozilla.org/directory/csdk-docs/function.htm#get-lderrno
Can you post the URL you are referencing?
> Thanks for the summary of intent. That helps me a lot! :)
>
> Regards,
> - Matthew
>