2 * Copyright (c) 1994 The Regents of the University of Michigan.
5 * free.c - some free routines are included here to avoid having to
6 * link in lots of extra code when not using certain features
12 static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n";
19 #include <ac/string.h>
25 ldap_getfilter_free( LDAPFiltDesc *lfdp )
27 LDAPFiltList *flp, *nextflp;
28 LDAPFiltInfo *fip, *nextfip;
30 for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
31 for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
32 nextfip = fip->lfi_next;
33 free( fip->lfi_filter );
34 free( fip->lfi_desc );
37 nextflp = flp->lfl_next;
38 free( flp->lfl_pattern );
39 free( flp->lfl_delims );
44 if ( lfdp->lfd_curvalcopy != NULL ) {
45 free( lfdp->lfd_curvalcopy );
47 if ( lfdp->lfd_curvalwords != NULL ) {
48 free( lfdp->lfd_curvalwords );
50 if ( lfdp->lfd_filtprefix != NULL ) {
51 free( lfdp->lfd_filtprefix );
53 if ( lfdp->lfd_filtsuffix != NULL ) {
54 free( lfdp->lfd_filtsuffix );
61 * free a null-terminated array of pointers to mod structures. the
62 * structures are freed, not the array itself, unless the freemods
67 ldap_mods_free( LDAPMod **mods, int freemods )
74 for ( i = 0; mods[i] != NULL; i++ ) {
75 if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
76 ber_bvecfree( mods[i]->mod_bvalues );
78 ldap_value_free( mods[i]->mod_values );
80 free( (char *) mods[i] );
84 free( (char *) mods );