xref: /freebsd/crypto/krb5/src/lib/gssapi/generic/rel_buffer.c (revision b670c9bafc0e31c7609969bf374b2e80bdc00211)
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /* #ident  "@(#)g_rel_buffer.c 1.2     96/02/06 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_buffer
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
38 generic_gss_release_buffer(
39     OM_uint32 *minor_status,
40     gss_buffer_t buffer)
41 {
42     if (minor_status)
43         *minor_status = 0;
44 
45     /* if buffer is NULL, return */
46 
47     if (buffer == GSS_C_NO_BUFFER)
48         return(GSS_S_COMPLETE);
49 
50     if (buffer->value) {
51         gssalloc_free(buffer->value);
52         buffer->length = 0;
53         buffer->value = NULL;
54     }
55 
56     return (GSS_S_COMPLETE);
57 }
58