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>
26 ldap_getfilter_free( LDAPFiltDesc *lfdp )
28 LDAPFiltList *flp, *nextflp;
29 LDAPFiltInfo *fip, *nextfip;
31 for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
32 for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
33 nextfip = fip->lfi_next;
34 free( fip->lfi_filter );
35 free( fip->lfi_desc );
38 nextflp = flp->lfl_next;
39 free( flp->lfl_pattern );
40 free( flp->lfl_delims );
45 if ( lfdp->lfd_curvalcopy != NULL ) {
46 free( lfdp->lfd_curvalcopy );
48 if ( lfdp->lfd_curvalwords != NULL ) {
49 free( lfdp->lfd_curvalwords );
51 if ( lfdp->lfd_filtprefix != NULL ) {
52 free( lfdp->lfd_filtprefix );
54 if ( lfdp->lfd_filtsuffix != NULL ) {
55 free( lfdp->lfd_filtsuffix );
62 * free a null-terminated array of pointers to mod structures. the
63 * structures are freed, not the array itself, unless the freemods
68 ldap_mods_free( LDAPMod **mods, int freemods )
75 for ( i = 0; mods[i] != NULL; i++ ) {
76 if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
77 ber_bvecfree( mods[i]->mod_bvalues );
79 ldap_value_free( mods[i]->mod_values );
81 free( (char *) mods[i] );
85 free( (char *) mods );