xref: /illumos-gate/usr/src/lib/libldap5/sources/ldap/common/freevalues.c (revision 42b53e0fbc5c05289c3d334bb864b784fafe5ce4)
1 /*
2  * The contents of this file are subject to the Netscape Public
3  * License Version 1.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.mozilla.org/NPL/
6  *
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  *
12  * The Original Code is Mozilla Communicator client code, released
13  * March 31, 1998.
14  *
15  * The Initial Developer of the Original Code is Netscape
16  * Communications Corporation. Portions created by Netscape are
17  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
18  * Rights Reserved.
19  *
20  * Contributor(s):
21  */
22 /*
23  *  Copyright (c) 1990 Regents of the University of Michigan.
24  *  All rights reserved.
25  */
26 /*
27  *  freevalues.c
28  */
29 
30 #include "ldap-int.h"
31 
32 void
33 LDAP_CALL
34 ldap_value_free( char **vals )
35 {
36 	int	i;
37 
38 	if ( vals == NULL )
39 		return;
40 	for ( i = 0; vals[i] != NULL; i++ )
41 		NSLDAPI_FREE( vals[i] );
42 	NSLDAPI_FREE( (char *) vals );
43 }
44 
45 void
46 LDAP_CALL
47 ldap_value_free_len( struct berval **vals )
48 {
49 	int	i;
50 
51 	if ( vals == NULL )
52 		return;
53 	for ( i = 0; vals[i] != NULL; i++ ) {
54 		NSLDAPI_FREE( vals[i]->bv_val );
55 		NSLDAPI_FREE( vals[i] );
56 	}
57 	NSLDAPI_FREE( (char *) vals );
58 }
59