1104834Sobrien/*	$NetBSD: free_host_realm.c,v 1.2 2017/01/28 21:31:49 christos Exp $	*/
278828Sobrien
378828Sobrien/*
478828Sobrien * Copyright (c) 1997, 1999 Kungliga Tekniska H��gskolan
578828Sobrien * (Royal Institute of Technology, Stockholm, Sweden).
678828Sobrien * All rights reserved.
778828Sobrien *
878828Sobrien * Redistribution and use in source and binary forms, with or without
978828Sobrien * modification, are permitted provided that the following conditions
1078828Sobrien * are met:
1178828Sobrien *
1278828Sobrien * 1. Redistributions of source code must retain the above copyright
1378828Sobrien *    notice, this list of conditions and the following disclaimer.
1478828Sobrien *
1578828Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1678828Sobrien *    notice, this list of conditions and the following disclaimer in the
1778828Sobrien *    documentation and/or other materials provided with the distribution.
1878828Sobrien *
1978828Sobrien * 3. Neither the name of the Institute nor the names of its contributors
2033965Sjdp *    may be used to endorse or promote products derived from this software
2133965Sjdp *    without specific prior written permission.
2233965Sjdp *
2333965Sjdp * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
2433965Sjdp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2533965Sjdp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2633965Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
2733965Sjdp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2833965Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2933965Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3033965Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3133965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3233965Sjdp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3333965Sjdp * SUCH DAMAGE.
3433965Sjdp */
3533965Sjdp
3633965Sjdp#include "krb5_locl.h"
3733965Sjdp
3833965Sjdp/**
3933965Sjdp * Free all memory allocated by `realmlist'
4033965Sjdp *
4133965Sjdp * @param context A Kerberos 5 context.
4233965Sjdp * @param realmlist realmlist to free, NULL is ok
4333965Sjdp *
4433965Sjdp * @return a Kerberos error code, always 0.
4533965Sjdp *
46104834Sobrien * @ingroup krb5_support
4733965Sjdp */
4833965Sjdp
4933965SjdpKRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
5033965Sjdpkrb5_free_host_realm(krb5_context context,
5133965Sjdp		     krb5_realm *realmlist)
5233965Sjdp{
5333965Sjdp    krb5_realm *p;
5433965Sjdp
5533965Sjdp    if(realmlist == NULL)
56130561Sobrien	return 0;
5733965Sjdp    for (p = realmlist; *p; ++p)
5833965Sjdp	free (*p);
5933965Sjdp    free (realmlist);
6033965Sjdp    return 0;
6133965Sjdp}
6233965Sjdp