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