1/* 2 * Copyright (c) 2011-12 Apple Inc. All Rights Reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23/* 24 * Copyright (c) 1997 - 2005 Kungliga Tekniska Högskolan 25 * (Royal Institute of Technology, Stockholm, Sweden). 26 * All rights reserved. 27 * 28 * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 29 * 30 * Redistribution and use in source and binary forms, with or without 31 * modification, are permitted provided that the following conditions 32 * are met: 33 * 34 * 1. Redistributions of source code must retain the above copyright 35 * notice, this list of conditions and the following disclaimer. 36 * 37 * 2. Redistributions in binary form must reproduce the above copyright 38 * notice, this list of conditions and the following disclaimer in the 39 * documentation and/or other materials provided with the distribution. 40 * 41 * 3. Neither the name of the Institute nor the names of its contributors 42 * may be used to endorse or promote products derived from this software 43 * without specific prior written permission. 44 * 45 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 48 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 55 * SUCH DAMAGE. 56 */ 57 58#include "asn1-der_locl.h" 59 60RCSID("$Id$"); 61 62void 63der_free_general_string (heim_general_string *str) 64{ 65 free(*str); 66 *str = NULL; 67} 68 69void 70der_free_integer (int *i) 71{ 72 *i = 0; 73} 74 75void 76der_free_unsigned (unsigned *u) 77{ 78 *u = 0; 79} 80 81void 82der_free_generalized_time(time_t *t) 83{ 84 *t = 0; 85} 86 87void 88der_free_utctime(time_t *t) 89{ 90 *t = 0; 91} 92 93 94void 95der_free_utf8string (heim_utf8_string *str) 96{ 97 free(*str); 98 *str = NULL; 99} 100 101void 102der_free_printable_string (heim_printable_string *str) 103{ 104 der_free_octet_string(str); 105} 106 107void 108der_free_ia5_string (heim_ia5_string *str) 109{ 110 der_free_octet_string(str); 111} 112 113void 114der_free_bmp_string (heim_bmp_string *k) 115{ 116 free(k->data); 117 k->data = NULL; 118 k->length = 0; 119} 120 121void 122der_free_universal_string (heim_universal_string *k) 123{ 124 free(k->data); 125 k->data = NULL; 126 k->length = 0; 127} 128 129void 130der_free_visible_string (heim_visible_string *str) 131{ 132 free(*str); 133 *str = NULL; 134} 135 136void 137der_free_octet_string (heim_octet_string *k) 138{ 139 free(k->data); 140 k->data = NULL; 141 k->length = 0; 142} 143 144void 145der_free_heim_integer (heim_integer *k) 146{ 147 free(k->data); 148 k->data = NULL; 149 k->length = 0; 150} 151 152void 153der_free_oid (heim_oid *k) 154{ 155 free(k->components); 156 k->components = NULL; 157 k->length = 0; 158} 159 160void 161der_free_bit_string (heim_bit_string *k) 162{ 163 free(k->data); 164 k->data = NULL; 165 k->length = 0; 166} 167