1178828Sdfr/*-
2229784Suqs * Copyright (c) 2006 Kungliga Tekniska H��gskolan
3178828Sdfr * (Royal Institute of Technology, Stockholm, Sweden).
4178828Sdfr * All rights reserved.
5178828Sdfr *
6178828Sdfr * Redistribution and use in source and binary forms, with or without
7178828Sdfr * modification, are permitted provided that the following conditions
8178828Sdfr * are met:
9178828Sdfr *
10178828Sdfr * 1. Redistributions of source code must retain the above copyright
11178828Sdfr *    notice, this list of conditions and the following disclaimer.
12178828Sdfr *
13178828Sdfr * 2. Redistributions in binary form must reproduce the above copyright
14178828Sdfr *    notice, this list of conditions and the following disclaimer in the
15178828Sdfr *    documentation and/or other materials provided with the distribution.
16178828Sdfr *
17178828Sdfr * 3. Neither the name of the Institute nor the names of its contributors
18178828Sdfr *    may be used to endorse or promote products derived from this software
19178828Sdfr *    without specific prior written permission.
20178828Sdfr *
21178828Sdfr * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22178828Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23178828Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24178828Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25178828Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26178828Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27178828Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28178828Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29178828Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30178828Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31178828Sdfr * SUCH DAMAGE.
32178828Sdfr */
33178828Sdfr/* $FreeBSD$ */
34178828Sdfr
35178828Sdfr#include <gssapi/gssapi.h>
36178828Sdfr#include <stdlib.h>
37178828Sdfr
38178828Sdfr/* RCSID("$Id: gss_release_oid.c 17747 2006-06-30 09:34:54Z lha $"); */
39178828Sdfr
40178828SdfrOM_uint32
41178828Sdfrgss_release_oid(OM_uint32 *minor_status, gss_OID *oid)
42178828Sdfr{
43178828Sdfr	gss_OID o = *oid;
44178828Sdfr
45178828Sdfr	*oid = GSS_C_NO_OID;
46178828Sdfr
47178828Sdfr	if (minor_status != NULL)
48178828Sdfr		*minor_status = 0;
49178828Sdfr
50178828Sdfr	if (o == GSS_C_NO_OID)
51178828Sdfr		return (GSS_S_COMPLETE);
52178828Sdfr
53178828Sdfr	if (o->elements != NULL) {
54178828Sdfr		free(o->elements);
55178828Sdfr		o->elements = NULL;
56178828Sdfr	}
57178828Sdfr	o->length = 0;
58178828Sdfr	free(o);
59178828Sdfr
60178828Sdfr	return (GSS_S_COMPLETE);
61178828Sdfr}
62