Path: blob/main/crypto/heimdal/lib/asn1/der_free.c
34889 views
/*1* Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan2* (Royal Institute of Technology, Stockholm, Sweden).3* All rights reserved.4*5* Portions Copyright (c) 2009 Apple Inc. All rights reserved.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10*11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions and the following disclaimer.13*14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* 3. Neither the name of the Institute nor the names of its contributors19* may be used to endorse or promote products derived from this software20* without specific prior written permission.21*22* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND23* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE24* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE25* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE26* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL27* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS28* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)29* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT30* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY31* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF32* SUCH DAMAGE.33*/3435#include "der_locl.h"3637RCSID("$Id$");3839void40der_free_general_string (heim_general_string *str)41{42free(*str);43*str = NULL;44}4546void47der_free_integer (int *i)48{49*i = 0;50}5152void53der_free_integer64 (int64_t *i)54{55*i = 0;56}5758void59der_free_unsigned (unsigned *u)60{61*u = 0;62}6364void65der_free_unsigned64 (uint64_t *u)66{67*u = 0;68}6970void71der_free_generalized_time(time_t *t)72{73*t = 0;74}7576void77der_free_utctime(time_t *t)78{79*t = 0;80}818283void84der_free_utf8string (heim_utf8_string *str)85{86free(*str);87*str = NULL;88}8990void91der_free_printable_string (heim_printable_string *str)92{93der_free_octet_string(str);94}9596void97der_free_ia5_string (heim_ia5_string *str)98{99der_free_octet_string(str);100}101102void103der_free_bmp_string (heim_bmp_string *k)104{105free(k->data);106k->data = NULL;107k->length = 0;108}109110void111der_free_universal_string (heim_universal_string *k)112{113free(k->data);114k->data = NULL;115k->length = 0;116}117118void119der_free_visible_string (heim_visible_string *str)120{121free(*str);122*str = NULL;123}124125void126der_free_octet_string (heim_octet_string *k)127{128free(k->data);129k->data = NULL;130k->length = 0;131}132133void134der_free_heim_integer (heim_integer *k)135{136free(k->data);137k->data = NULL;138k->length = 0;139}140141void142der_free_oid (heim_oid *k)143{144free(k->components);145k->components = NULL;146k->length = 0;147}148149void150der_free_bit_string (heim_bit_string *k)151{152free(k->data);153k->data = NULL;154k->length = 0;155}156157158