Skip to content

Commit

Permalink
KRB: Prevent dereference of a null pointer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lukas Slebodnik authored and jhrozek committed Jun 3, 2014
1 parent 2d9df96 commit fa9d246
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/providers/krb5/krb5_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fa9d246

Please sign in to comment.