summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-11-06 20:02:21 +0100
committerSimo Sorce <ssorce@redhat.com>2009-11-06 17:57:07 -0500
commit42a21a6fec2925d3cfb0a92aa7e4342912ba9874 (patch)
tree5c003be1358528d6db6a5f382a89199f0e911fc4
parent13b614c9fca3a6c9a34cd666cf4912893e2e02e8 (diff)
downloadsssd-42a21a6fec2925d3cfb0a92aa7e4342912ba9874.tar.gz
sssd-42a21a6fec2925d3cfb0a92aa7e4342912ba9874.tar.bz2
sssd-42a21a6fec2925d3cfb0a92aa7e4342912ba9874.zip
Check is ccache structure is initialized before calling krb5_cc_destroy
-rw-r--r--server/providers/krb5/krb5_child.c24
1 files changed, 16 insertions, 8 deletions
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;
}