In the ff. operations: ldap_search_s(ld,basedn,scope,filter,attrs,1,&result) msg = ldap_first_entry dn = ldap_get_dn Do I have to 'free' the memory allocated for the variables: result, msg, and dn?