Misc fixes (coverity)

This commit is contained in:
Nicolas Williams
2016-11-28 15:09:55 -06:00
parent f38089257b
commit 3ba12317a0
12 changed files with 116 additions and 107 deletions

View File

@@ -50,6 +50,7 @@ kcm_ccache_acquire(krb5_context context,
char *in_tkt_service = NULL;
const char *estr;
*credp = NULL;
memset(&cred, 0, sizeof(cred));
KCM_ASSERT_VALID(ccache);
@@ -82,7 +83,7 @@ kcm_ccache_acquire(krb5_context context,
kcm_log(0, "Failed to unparse service principal name for cache %s: %s",
ccache->name, estr);
krb5_free_error_message(context, estr);
return ret;
goto out;
}
}
@@ -121,14 +122,9 @@ kcm_ccache_acquire(krb5_context context,
kcm_log(0, "Failed to acquire credentials for cache %s: %s",
ccache->name, estr);
krb5_free_error_message(context, estr);
if (in_tkt_service != NULL)
free(in_tkt_service);
goto out;
}
if (in_tkt_service != NULL)
free(in_tkt_service);
/* Swap them in */
kcm_ccache_remove_creds_internal(context, ccache);
@@ -143,6 +139,7 @@ kcm_ccache_acquire(krb5_context context,
}
out:
free(in_tkt_service);
if (opt)
krb5_get_init_creds_opt_free(context, opt);

View File

@@ -1137,17 +1137,19 @@ kcm_op_set_default_cache(krb5_context context,
}
if (c == NULL) {
c = malloc(sizeof(*c));
if (c == NULL)
if (c == NULL) {
free(name);
return ENOMEM;
}
c->session = client->session;
c->uid = client->uid;
c->name = strdup(name);
c->name = name;
c->next = default_caches;
default_caches = c;
} else {
free(c->name);
c->name = strdup(name);
c->name = name;
}
return 0;