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
10 static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University of Michigan.\nAll rights reserved.\n";
25 #include <sys/types.h>
34 ldap_getfilter_free( LDAPFiltDesc *lfdp )
36 LDAPFiltList *flp, *nextflp;
37 LDAPFiltInfo *fip, *nextfip;
39 for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = nextflp ) {
40 for ( fip = flp->lfl_ilist; fip != NULL; fip = nextfip ) {
41 nextfip = fip->lfi_next;
42 free( fip->lfi_filter );
43 free( fip->lfi_desc );
46 nextflp = flp->lfl_next;
47 free( flp->lfl_pattern );
48 free( flp->lfl_delims );
53 if ( lfdp->lfd_curvalcopy != NULL ) {
54 free( lfdp->lfd_curvalcopy );
56 if ( lfdp->lfd_curvalwords != NULL ) {
57 free( lfdp->lfd_curvalwords );
59 if ( lfdp->lfd_filtprefix != NULL ) {
60 free( lfdp->lfd_filtprefix );
62 if ( lfdp->lfd_filtsuffix != NULL ) {
63 free( lfdp->lfd_filtsuffix );
70 * free a null-terminated array of pointers to mod structures. the
71 * structures are freed, not the array itself, unless the freemods
76 ldap_mods_free( LDAPMod **mods, int freemods )
83 for ( i = 0; mods[i] != NULL; i++ ) {
84 if ( mods[i]->mod_op & LDAP_MOD_BVALUES ) {
85 ber_bvecfree( mods[i]->mod_bvalues );
87 ldap_value_free( mods[i]->mod_values );
89 free( (char *) mods[i] );
93 free( (char *) mods );