Skip to content

Commit

Permalink
Remove unnecessary null checks
Browse files Browse the repository at this point in the history
Remove some null checks for values that should never be null.  These
checks were performed inconsistently and triggered static code
analysis tools.
  • Loading branch information
Martin Kittel authored and greghudson committed Mar 29, 2017
1 parent d9afa34 commit 07907bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
21 changes: 7 additions & 14 deletions src/lib/gssapi/krb5/naming_exts.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ krb5_gss_inquire_name(OM_uint32 *minor_status,
krb5_gss_name_t kname;
krb5_data *kattrs = NULL;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

if (attrs != NULL)
*attrs = GSS_C_NO_BUFFER_SET;
Expand Down Expand Up @@ -322,8 +321,7 @@ krb5_gss_get_name_attribute(OM_uint32 *minor_status,
krb5_data kvalue = empty_data();
krb5_data kdisplay_value = empty_data();

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down Expand Up @@ -393,8 +391,7 @@ krb5_gss_set_name_attribute(OM_uint32 *minor_status,
krb5_data kattr;
krb5_data kvalue;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down Expand Up @@ -443,8 +440,7 @@ krb5_gss_delete_name_attribute(OM_uint32 *minor_status,
krb5_gss_name_t kname;
krb5_data kattr;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down Expand Up @@ -490,8 +486,7 @@ krb5_gss_map_name_to_any(OM_uint32 *minor_status,
krb5_gss_name_t kname;
char *kmodule;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down Expand Up @@ -542,8 +537,7 @@ krb5_gss_release_any_name_mapping(OM_uint32 *minor_status,
krb5_gss_name_t kname;
char *kmodule;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down Expand Up @@ -598,8 +592,7 @@ krb5_gss_export_name_composite(OM_uint32 *minor_status,
unsigned char *cp;
size_t princlen;

if (minor_status != NULL)
*minor_status = 0;
*minor_status = 0;

code = krb5_gss_init_context(&context);
if (code != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/krb5/krb/preauth2.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ responder_get_answer(krb5_context context, krb5_clpreauth_rock rock,
krb5_init_creds_context ctx = (krb5_init_creds_context)rock;

/* Don't let plugins get the raw password. */
if (question && strcmp(KRB5_RESPONDER_QUESTION_PASSWORD, question) == 0)
if (strcmp(KRB5_RESPONDER_QUESTION_PASSWORD, question) == 0)
return NULL;
return k5_response_items_get_answer(ctx->rctx.items, question);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/krb5/rcache/ser_rc.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ krb5_rcache_size(krb5_context kcontext, krb5_pointer arg, size_t *sizep)
* krb5_int32 for KV5M_RCACHE
*/
required = sizeof(krb5_int32) * 3;
if (rcache->ops && rcache->ops->type)
if (rcache->ops)
required += (strlen(rcache->ops->type)+1);

/*
Expand Down

0 comments on commit 07907bc

Please sign in to comment.