From 42a21a6fec2925d3cfb0a92aa7e4342912ba9874 Mon Sep 17 00:00:00 2001 From: Sumit Bose Date: Fri, 6 Nov 2009 20:02:21 +0100 Subject: Check is ccache structure is initialized before calling krb5_cc_destroy --- server/providers/krb5/krb5_child.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'server/providers/krb5') diff --git a/server/providers/krb5/krb5_child.c b/server/providers/krb5/krb5_child.c index 319775a2..2630e0f4 100644 --- a/server/providers/krb5/krb5_child.c +++ b/server/providers/krb5/krb5_child.c @@ -343,8 +343,10 @@ sendresponse: resp = prepare_response_message(kr, kerr, pam_status); if (resp == NULL) { DEBUG(1, ("prepare_response_message failed.\n")); - krb5_cc_destroy(kr->ctx, kr->cc); - kr->cc = NULL; + if (kr->cc != NULL) { + krb5_cc_destroy(kr->ctx, kr->cc); + kr->cc = NULL; + } return ENOMEM; } @@ -352,8 +354,10 @@ sendresponse: if (ret == -1) { err = errno; DEBUG(1, ("write failed [%d][%s].\n", errno, strerror(errno))); - krb5_cc_destroy(kr->ctx, kr->cc); - kr->cc = NULL; + if (kr->cc != NULL) { + krb5_cc_destroy(kr->ctx, kr->cc); + kr->cc = NULL; + } return err; } @@ -421,8 +425,10 @@ sendresponse: resp = prepare_response_message(kr, kerr, pam_status); if (resp == NULL) { DEBUG(1, ("prepare_response_message failed.\n")); - krb5_cc_destroy(kr->ctx, kr->cc); - kr->cc = NULL; + if (kr->cc != NULL) { + krb5_cc_destroy(kr->ctx, kr->cc); + kr->cc = NULL; + } return ENOMEM; } @@ -430,8 +436,10 @@ sendresponse: if (ret == -1) { err = errno; DEBUG(1, ("write failed [%d][%s].\n", errno, strerror(errno))); - krb5_cc_destroy(kr->ctx, kr->cc); - kr->cc = NULL; + if (kr->cc != NULL) { + krb5_cc_destroy(kr->ctx, kr->cc); + kr->cc = NULL; + } return err; } -- cgit