[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Free Attribute with dummy empty values
- To: OpenLDAP Devel <openldap-devel@OpenLDAP.org>
- Subject: Free Attribute with dummy empty values
- From: Pierangelo Masarati <ando@sys-net.it>
- Date: Fri, 13 May 2005 01:03:46 +0200
- Domainkey-signature: a=rsa-sha1; s=mail; d=sys-net.it; c=simple; q=dns; b=j/fQ5rSRpNihtkAPOUssMoF3BmSFFa/IsZG9HEqHuJ7yG6CLwGai84D1wl5EbpCRw E1exEH2eLucXS61YHCXYQ==
- User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050209 LPT-Desktop/1.7.5-3.9.el3.lpt
In back-ldap we've a piece of code like this
if ( a->a_nvals != a->a_vals ) {
ber_bvarray_free( a->a_nvals );
}
if ( a->a_vals != &slap_dummy_bv ) {
ber_bvarray_free( a->a_vals );
}
ch_free( a );
that is used to free an Attribute when the value may be set to &slap_dummy_bv to indicate that's empty (e.g. attrsonly) without allocating a BER_BVNULL. I think this test could move to attr_free(), like
diff -u -r1.106 attr.c
--- servers/slapd/attr.c 21 Apr 2005 21:35:00 -0000 1.106
+++ servers/slapd/attr.c 12 May 2005 23:02:33 -0000
@@ -46,7 +46,9 @@
if ( a->a_nvals && a->a_nvals != a->a_vals ) {
ber_bvarray_free( a->a_nvals );
}
- ber_bvarray_free( a->a_vals );
+ if ( a->a_vals != &slap_dummy_bv ) {
+ ber_bvarray_free( a->a_vals );
+ }
free( a );
}
so that it can be used elsewhere. This would allow, for instance, back-ldap/back-meta to send entries marked as REP_ENTRY_MODIFIABLE.
Comments?
p.
SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497