Sheesh

Oct. 18th, 2005 03:47 pm
sweh: (Default)
[personal profile] sweh
I noticed one of my programs had a pretty bad memory leak, so I checked the manpage for various functions...

Good grief... so many routines called in OpenLDAP dynamically allocate memory for you and require unique and clever ways of deallocating it when you've finished...

A simple search, iterate through the returned entries and then through the attributes for each entry require use of:
free() - for data allocated by ldap_get_dn()
ldap_msgfree() - for ldap_search_st()
ldap_value_free() - for ldap_get_vals()
ldap_memfree() - for ldap_first_attribute() and ldap_next_attribute()
ber_free() - also for ldap_first_attribute() and ldap_next_attribute()

Sheesh!

April 2026

S M T W T F S
    1234
567891011
12131415161718
192021 22232425
2627282930  

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 5th, 2026 02:52 pm
Powered by Dreamwidth Studios