From e81dac9b62af7b02505aee04af71ca945ba3b091 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 26 Aug 2000 11:43:30 +0000 Subject: [PATCH] (krb5_auth_con_free): handle auth_context == NULL git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8994 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/auth_context.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index 02763d3ae..bbfb15c04 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -67,20 +67,21 @@ krb5_error_code krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context) { - krb5_free_authenticator(context, &auth_context->authenticator); - if(auth_context->local_address){ - free_HostAddress(auth_context->local_address); - free(auth_context->local_address); - } - if(auth_context->remote_address){ - free_HostAddress(auth_context->remote_address); - free(auth_context->remote_address); - } - if(auth_context->keyblock) + if (auth_context != NULL) { + krb5_free_authenticator(context, &auth_context->authenticator); + if(auth_context->local_address){ + free_HostAddress(auth_context->local_address); + free(auth_context->local_address); + } + if(auth_context->remote_address){ + free_HostAddress(auth_context->remote_address); + free(auth_context->remote_address); + } krb5_free_keyblock(context, auth_context->keyblock); - krb5_free_keyblock(context, auth_context->remote_subkey); - krb5_free_keyblock(context, auth_context->local_subkey); - free (auth_context); + krb5_free_keyblock(context, auth_context->remote_subkey); + krb5_free_keyblock(context, auth_context->local_subkey); + free (auth_context); + } return 0; }