From 47364ff6694cc8b82ffed8eb101f7e1a812af044 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 1 Dec 1993 21:56:08 +0000 Subject: [PATCH] Make sure the ticket_info array is freed, not just its contents; and test to make sure ticket_info is set before trying to free it and its contents. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3053 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/free/f_cred_enc.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/krb5/free/f_cred_enc.c b/src/lib/krb5/free/f_cred_enc.c index 5ca6102d0..e9091290c 100644 --- a/src/lib/krb5/free/f_cred_enc.c +++ b/src/lib/krb5/free/f_cred_enc.c @@ -44,16 +44,19 @@ register krb5_cred_enc_part *val; if (val->s_address) krb5_free_address(val->s_address); - for (temp = val->ticket_info; *temp; temp++) { - if ((*temp)->session) - krb5_free_keyblock((*temp)->session); - if ((*temp)->client) - krb5_free_principal((*temp)->client); - if ((*temp)->server) - krb5_free_principal((*temp)->server); - if ((*temp)->caddrs) - krb5_free_addresses((*temp)->caddrs); - krb5_xfree((*temp)); + if (val->ticket_info) { + for (temp = val->ticket_info; *temp; temp++) { + if ((*temp)->session) + krb5_free_keyblock((*temp)->session); + if ((*temp)->client) + krb5_free_principal((*temp)->client); + if ((*temp)->server) + krb5_free_principal((*temp)->server); + if ((*temp)->caddrs) + krb5_free_addresses((*temp)->caddrs); + krb5_xfree((*temp)); + } + krb5_xfree(val->ticket_info); } krb5_xfree(val); return; -- 2.26.2