xref: /illumos-gate/usr/src/lib/gss_mechs/mech_krb5/mech/rel_oid_set.c (revision a89c0811c892ec231725fe10817ef95dda813c06)
1 /*
2  * Copyright 1996 by Sun Microsystems, Inc.
3  *
4  * Permission to use, copy, modify, distribute, and sell this software
5  * and its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appears in all copies and
7  * that both that copyright notice and this permission notice appear in
8  * supporting documentation, and that the name of Sun Microsystems not be used
9  * in advertising or publicity pertaining to distribution of the software
10  * without specific, written prior permission. Sun Microsystems makes no
11  * representations about the suitability of this software for any
12  * purpose.  It is provided "as is" without express or implied warranty.
13  *
14  * SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16  * EVENT SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THIS SOFTWARE.
21  */
22 
23 /*
24  *  glue routine for gss_release_oid_set
25  */
26 
27 #include "gssapiP_generic.h"
28 
29 #include <stdio.h>
30 #ifdef HAVE_STDLIB_H
31 #include <stdlib.h>
32 #endif
33 
34 OM_uint32
35 generic_gss_release_oid_set (minor_status,
36 			     set)
37      OM_uint32 *		minor_status;
38      gss_OID_set *		set;
39 {
40     size_t i;
41     if (minor_status)
42 	*minor_status = 0;
43 
44     if (set == NULL)
45 	return(GSS_S_COMPLETE);
46 
47     if (*set == GSS_C_NULL_OID_SET)
48 	return(GSS_S_COMPLETE);
49 
50     for (i=0; i<(*set)->count; i++)
51 	free((*set)->elements[i].elements);
52 
53     free((*set)->elements);
54     free(*set);
55 
56     *set = GSS_C_NULL_OID_SET;
57 
58     return(GSS_S_COMPLETE);
59 }
60