2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 * Copyright (c) 1994 The Regents of the University of Michigan.
9 * free.c - some free routines are included here to avoid having to
10 * link in lots of extra code when not using certain features
19 #include <ac/string.h>
28 ldap_memfree( void *p )
36 ldap_getfilter_free( LDAPFiltDesc *lfdp )
38 LDAPFiltList *flp, *nextflp;
39 LDAPFiltInfo *fip, *nextfip;
41 for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
42 for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
43 nextfip = fip->lfi_next;
44 free( fip->lfi_filter );
45 free( fip->lfi_desc );
48 nextflp = flp->lfl_next;
49 free( flp->lfl_pattern );
50 free( flp->lfl_delims );
55 if ( lfdp->lfd_curvalcopy != NULL ) {
56 free( lfdp->lfd_curvalcopy );
58 if ( lfdp->lfd_curvalwords != NULL ) {
59 free( lfdp->lfd_curvalwords );
61 if ( lfdp->lfd_filtprefix != NULL ) {
62 free( lfdp->lfd_filtprefix );
64 if ( lfdp->lfd_filtsuffix != NULL ) {
65 free( lfdp->lfd_filtsuffix );
72 * free a null-terminated array of pointers to mod structures. the
73 * structures are freed, not the array itself, unless the freemods
78 ldap_mods_free( LDAPMod **mods, int freemods )
85 for ( i = 0; mods[i] != NULL; i++ ) {
86 if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
87 ber_bvecfree( mods[i]->mod_bvalues );
89 ldap_value_free( mods[i]->mod_values );
91 free( (char *) mods[i] );
95 free( (char *) mods );