It's building a custom LDAPDN object from an internal data structure to
be used with ldap_dn2str(). The use-case for such flag/pointer ownership
for others may be limited as I suspect not so many build their own
LDAPDN objects from scratch.
On 2018-11-30 16:11, Howard Chu wrote:
Erik Lax wrote:
> In our case the pointer/allocated string ownership is preferable moved to the LDAPAVA
object for both the value and attribute as the char* does not have the
> same lifetime as the LDAPAVA object.
Then your app is almost certainly mis-designed. The set of attributeTypes in a schema is
and usually small; alloc'ing and free'ing the same strings over and over is
Out of curiosity, what is your software actually trying to do?
> On 2018-11-30 14:51, Howard Chu wrote:
>> erik(a)halon.se wrote:
>>> Full_Name: Erik Lax
>>> Version: 2.4.46
>>> OS: Linux
>>> Submission from: (NULL) (18.104.22.168)
>>> It's possible to set the flag LDAP_AVA_FREE_VALUE to clear ber values on
>>> LDAPAVA structure in ldapava_free() but it's not possible to set the
>>> LDAP_AVA_FREE_ATTR to clear attributes. I suspect OpenLDAP internals does
>>> need to free attributes in this way (hence the missing code).
>> Attribute Types are usually constant strings, so right, there should be no need
to free them.
>>> I'm building a custom LDAPAVA (LDAPDN) object and it would be useful to
>>> to set this flags to have it properly clean up both values and attributes in
>> It would be better to simply avoid the need to free them.