diff options
author | Greg Hudson <ghudson@mit.edu> | 2013-07-11 20:39:51 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2013-07-11 20:39:51 -0400 |
commit | 443ce5fef316e3dc324fe84557a06b069dbe33f9 (patch) | |
tree | 1aa5e33e71690fdbd4d3f7dc36ea3de8b82869df /src/plugins | |
parent | 90f9f6f6708baff4de2162c5eb754bb4bc557845 (diff) | |
download | krb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.tar.gz krb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.tar.xz krb5-443ce5fef316e3dc324fe84557a06b069dbe33f9.zip |
Use k5calloc instead of k5alloc where appropriate
Wherever we use k5alloc with a multiplication in the size parameter,,
use the new k5calloc helper function instead.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/kdb/hdb/kdb_marshal.c | 18 | ||||
-rw-r--r-- | src/plugins/kdb/hdb/kdb_windc.c | 4 | ||||
-rw-r--r-- | src/plugins/preauth/otp/otp_state.c | 4 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/plugins/kdb/hdb/kdb_marshal.c b/src/plugins/kdb/hdb/kdb_marshal.c index 3b2878a3f..b6a7dc40c 100644 --- a/src/plugins/kdb/hdb/kdb_marshal.c +++ b/src/plugins/kdb/hdb/kdb_marshal.c @@ -187,9 +187,9 @@ kh_marshal_Principal(krb5_context context, return code; hprinc->name.name_type = kprinc->type; - hprinc->name.name_string.val = k5alloc(kprinc->length * - sizeof(heim_general_string), - &code); + hprinc->name.name_string.val = k5calloc(kprinc->length, + sizeof(heim_general_string), + &code); if (code != 0) { kh_free_Principal(context, hprinc); return code; @@ -229,8 +229,8 @@ kh_unmarshal_Principal(krb5_context context, kprinc->magic = KV5M_PRINCIPAL; kprinc->type = hprinc->name.name_type; - kprinc->data = k5alloc(hprinc->name.name_string.len * sizeof(krb5_data), - &code); + kprinc->data = k5calloc(hprinc->name.name_string.len, sizeof(krb5_data), + &code); if (code != 0) { krb5_free_principal(context, kprinc); return code; @@ -594,7 +594,8 @@ kh_marshal_HDB_extensions(krb5_context context, unsigned int i; krb5_error_code code; - hexts->val = k5alloc(kh_hdb_extension_count * sizeof(HDB_extension), &code); + hexts->val = k5calloc(kh_hdb_extension_count, sizeof(HDB_extension), + &code); if (code != 0) return code; @@ -704,7 +705,7 @@ kh_marshal_hdb_entry(krb5_context context, goto cleanup; hentry->keys.len = 0; - hentry->keys.val = k5alloc(kentry->n_key_data * sizeof(Key), &code); + hentry->keys.val = k5calloc(kentry->n_key_data, sizeof(Key), &code); if (code != 0) goto cleanup; @@ -788,7 +789,8 @@ kh_unmarshal_hdb_entry(krb5_context context, if (code != 0) goto cleanup; - kentry->key_data = k5alloc(hentry->keys.len * sizeof(krb5_key_data), &code); + kentry->key_data = k5calloc(hentry->keys.len, sizeof(krb5_key_data), + &code); if (code != 0) goto cleanup; diff --git a/src/plugins/kdb/hdb/kdb_windc.c b/src/plugins/kdb/hdb/kdb_windc.c index bb07f4ccc..48140a5b2 100644 --- a/src/plugins/kdb/hdb/kdb_windc.c +++ b/src/plugins/kdb/hdb/kdb_windc.c @@ -342,7 +342,7 @@ kh_db_sign_auth_data(krb5_context context, goto cleanup; if (authdata == NULL) { - authdata = k5alloc(2 * sizeof(krb5_authdata *), &code); + authdata = k5calloc(2, sizeof(krb5_authdata *), &code); if (code != 0) goto cleanup; @@ -461,7 +461,7 @@ kh_marshall_HostAddresses(krb5_context context, return code; haddresses->len = 0; - haddresses->val = k5alloc(i * sizeof(HostAddress), &code); + haddresses->val = k5calloc(i, sizeof(HostAddress), &code); if (code != 0) return code; diff --git a/src/plugins/preauth/otp/otp_state.c b/src/plugins/preauth/otp/otp_state.c index f2a64a404..a4d7e3b5e 100644 --- a/src/plugins/preauth/otp/otp_state.c +++ b/src/plugins/preauth/otp/otp_state.c @@ -293,7 +293,7 @@ token_types_decode(profile_t profile, token_type **out) } /* Leave space for the default (possibly) and the terminator. */ - types = k5alloc((i + 2) * sizeof(token_type), &retval); + types = k5calloc(i + 2, sizeof(token_type), &retval); if (types == NULL) goto cleanup; @@ -441,7 +441,7 @@ tokens_decode(krb5_context ctx, krb5_const_principal princ, return retval; len = k5_json_array_length(arr); - tokens = k5alloc((len + 1) * sizeof(token), &retval); + tokens = k5calloc(len + 1, sizeof(token), &retval); if (tokens == NULL) goto cleanup; |