summaryrefslogtreecommitdiffstats
path: root/src/providers/krb5
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2014-03-12 18:03:26 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-03-13 13:11:07 +0100
commita32fdbf60ace9b05ea2b823e1a539562cad53c8e (patch)
tree9bfa9aeb8a30e6b826b7a79908b743a7d2903eb6 /src/providers/krb5
parent1d3cb26bfcd482e8b9718933eea1037eba1c49d7 (diff)
downloadsssd-a32fdbf60ace9b05ea2b823e1a539562cad53c8e.tar.gz
sssd-a32fdbf60ace9b05ea2b823e1a539562cad53c8e.tar.xz
sssd-a32fdbf60ace9b05ea2b823e1a539562cad53c8e.zip
KRB: Prevent dereference of a null pointer
Reported by: scan-build krb5_free_principal(cc->context, ccprinc); ^~ warning: Access to field 'context' results in a dereference of a null pointer (loaded from variable 'cc') Variable 'cc' needn't be initialised if function sss_open_ccache_as_user fails. Reviewed-by: Sumit Bose <sbose@redhat.com>
Diffstat (limited to 'src/providers/krb5')
-rw-r--r--src/providers/krb5/krb5_utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/providers/krb5/krb5_utils.c b/src/providers/krb5/krb5_utils.c
index 221b87402..27572c4ea 100644
--- a/src/providers/krb5/krb5_utils.c
+++ b/src/providers/krb5/krb5_utils.c
@@ -975,8 +975,10 @@ errno_t sss_krb5_check_ccache_princ(uid_t uid, gid_t gid,
ret = ERR_NOT_FOUND;
done:
- krb5_free_principal(cc->context, ccprinc);
- krb5_free_principal(cc->context, kprinc);
+ if (cc) {
+ krb5_free_principal(cc->context, ccprinc);
+ krb5_free_principal(cc->context, kprinc);
+ }
talloc_free(tmp_ctx);
return ret;
}