Round #3 of scan-build warnings cleanup

This commit is contained in:
Nicolas Williams
2016-11-16 23:27:27 -06:00
parent 1c81ddf4e2
commit 7fa85e6d6d
10 changed files with 32 additions and 16 deletions

View File

@@ -283,7 +283,8 @@ kadm5_setkey_principal_3(void *server_handle,
return ret;
if (keepold) {
new_key_data = malloc((n_keys + princ_ent.n_key_data) * sizeof(*new_key_data));
new_key_data = calloc((n_keys + princ_ent.n_key_data),
sizeof(*new_key_data));
if (new_key_data == NULL) {
ret = ENOMEM;
goto out;
@@ -292,7 +293,7 @@ kadm5_setkey_principal_3(void *server_handle,
memcpy(&new_key_data[n_keys], &princ_ent.key_data[0],
princ_ent.n_key_data * sizeof (princ_ent.key_data[0]));
} else {
new_key_data = malloc(n_keys * sizeof(*new_key_data));
new_key_data = calloc(n_keys, sizeof(*new_key_data));
if (new_key_data == NULL) {
ret = ENOMEM;
goto out;
@@ -324,8 +325,10 @@ kadm5_setkey_principal_3(void *server_handle,
*/
new_key_data[i].key_data_type[1] = 0;
if (n_ks_tuple > 0) {
if (ks_tuple[i].ks_enctype != keyblocks[i].keytype)
return KADM5_SETKEY3_ETYPE_MISMATCH;
if (ks_tuple[i].ks_enctype != keyblocks[i].keytype) {
ret = KADM5_SETKEY3_ETYPE_MISMATCH;
goto out;
}
new_key_data[i].key_data_type[1] = ks_tuple[i].ks_salttype;
}
new_key_data[i].key_data_length[1] = 0;