133f12199SDoug Rabson /*-
2*8a16b7a1SPedro F. Giffuni * SPDX-License-Identifier: BSD-3-Clause
3*8a16b7a1SPedro F. Giffuni *
4bf3f9db6SUlrich Spörlein * Copyright (c) 2006 Kungliga Tekniska Högskolan
533f12199SDoug Rabson * (Royal Institute of Technology, Stockholm, Sweden).
633f12199SDoug Rabson * All rights reserved.
733f12199SDoug Rabson *
833f12199SDoug Rabson * Redistribution and use in source and binary forms, with or without
933f12199SDoug Rabson * modification, are permitted provided that the following conditions
1033f12199SDoug Rabson * are met:
1133f12199SDoug Rabson *
1233f12199SDoug Rabson * 1. Redistributions of source code must retain the above copyright
1333f12199SDoug Rabson * notice, this list of conditions and the following disclaimer.
1433f12199SDoug Rabson *
1533f12199SDoug Rabson * 2. Redistributions in binary form must reproduce the above copyright
1633f12199SDoug Rabson * notice, this list of conditions and the following disclaimer in the
1733f12199SDoug Rabson * documentation and/or other materials provided with the distribution.
1833f12199SDoug Rabson *
1933f12199SDoug Rabson * 3. Neither the name of the Institute nor the names of its contributors
2033f12199SDoug Rabson * may be used to endorse or promote products derived from this software
2133f12199SDoug Rabson * without specific prior written permission.
2233f12199SDoug Rabson *
2333f12199SDoug Rabson * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2433f12199SDoug Rabson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2533f12199SDoug Rabson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2633f12199SDoug Rabson * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2733f12199SDoug Rabson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2833f12199SDoug Rabson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2933f12199SDoug Rabson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3033f12199SDoug Rabson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3133f12199SDoug Rabson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3233f12199SDoug Rabson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3333f12199SDoug Rabson * SUCH DAMAGE.
3433f12199SDoug Rabson */
3533f12199SDoug Rabson
3633f12199SDoug Rabson #include <gssapi/gssapi.h>
3733f12199SDoug Rabson #include <stdlib.h>
3833f12199SDoug Rabson
3933f12199SDoug Rabson /* RCSID("$Id: gss_release_oid.c 17747 2006-06-30 09:34:54Z lha $"); */
4033f12199SDoug Rabson
4133f12199SDoug Rabson OM_uint32
gss_release_oid(OM_uint32 * minor_status,gss_OID * oid)4233f12199SDoug Rabson gss_release_oid(OM_uint32 *minor_status, gss_OID *oid)
4333f12199SDoug Rabson {
4433f12199SDoug Rabson gss_OID o = *oid;
4533f12199SDoug Rabson
4633f12199SDoug Rabson *oid = GSS_C_NO_OID;
4733f12199SDoug Rabson
4833f12199SDoug Rabson if (minor_status != NULL)
4933f12199SDoug Rabson *minor_status = 0;
5033f12199SDoug Rabson
5133f12199SDoug Rabson if (o == GSS_C_NO_OID)
5233f12199SDoug Rabson return (GSS_S_COMPLETE);
5333f12199SDoug Rabson
5433f12199SDoug Rabson if (o->elements != NULL) {
5533f12199SDoug Rabson free(o->elements);
5633f12199SDoug Rabson o->elements = NULL;
5733f12199SDoug Rabson }
5833f12199SDoug Rabson o->length = 0;
5933f12199SDoug Rabson free(o);
6033f12199SDoug Rabson
6133f12199SDoug Rabson return (GSS_S_COMPLETE);
6233f12199SDoug Rabson }
63