summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-07-11 20:39:51 -0400
committerGreg Hudson <ghudson@mit.edu>2013-07-11 20:39:51 -0400
commit443ce5fef316e3dc324fe84557a06b069dbe33f9 (patch)
tree1aa5e33e71690fdbd4d3f7dc36ea3de8b82869df /src/lib/krb5
parent90f9f6f6708baff4de2162c5eb754bb4bc557845 (diff)
downloadkrb5-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/lib/krb5')
-rw-r--r--src/lib/krb5/ccache/ccselect.c2
-rw-r--r--src/lib/krb5/krb/preauth_encts.c2
-rw-r--r--src/lib/krb5/krb/s4u_authdata.c8
-rw-r--r--src/lib/krb5/krb/send_tgs.c2
-rw-r--r--src/lib/krb5/os/expand_path.c2
-rw-r--r--src/lib/krb5/os/localauth.c2
6 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/krb5/ccache/ccselect.c b/src/lib/krb5/ccache/ccselect.c
index 235c0c6a46..2f3071a272 100644
--- a/src/lib/krb5/ccache/ccselect.c
+++ b/src/lib/krb5/ccache/ccselect.c
@@ -77,7 +77,7 @@ load_modules(krb5_context context)
/* Allocate a large enough list of handles. */
for (count = 0; modules[count] != NULL; count++);
- list = k5alloc((count + 1) * sizeof(*list), &ret);
+ list = k5calloc(count + 1, sizeof(*list), &ret);
if (list == NULL)
goto cleanup;
diff --git a/src/lib/krb5/krb/preauth_encts.c b/src/lib/krb5/krb/preauth_encts.c
index b8295aaf4d..cec3842271 100644
--- a/src/lib/krb5/krb/preauth_encts.c
+++ b/src/lib/krb5/krb/preauth_encts.c
@@ -92,7 +92,7 @@ encts_process(krb5_context context, krb5_clpreauth_moddata moddata,
if (ret)
goto cleanup;
- pa = k5alloc(2 * sizeof(krb5_pa_data *), &ret);
+ pa = k5calloc(2, sizeof(krb5_pa_data *), &ret);
if (pa == NULL)
goto cleanup;
diff --git a/src/lib/krb5/krb/s4u_authdata.c b/src/lib/krb5/krb/s4u_authdata.c
index d93e758169..5b4704b752 100644
--- a/src/lib/krb5/krb/s4u_authdata.c
+++ b/src/lib/krb5/krb/s4u_authdata.c
@@ -165,7 +165,7 @@ s4u2proxy_export_authdata(krb5_context kcontext,
memset(&sp, 0, sizeof(sp));
sp.delegated = s4uctx->delegated;
- authdata = k5alloc(2 * sizeof(krb5_authdata *), &code);
+ authdata = k5calloc(2, sizeof(krb5_authdata *), &code);
if (authdata == NULL)
return code;
@@ -253,7 +253,7 @@ s4u2proxy_get_attribute_types(krb5_context kcontext,
if (s4uctx->count == 0)
return ENOENT;
- attrs = k5alloc(2 * sizeof(krb5_data), &code);
+ attrs = k5calloc(2, sizeof(krb5_data), &code);
if (attrs == NULL)
goto cleanup;
@@ -379,7 +379,7 @@ s4u2proxy_export_internal(krb5_context kcontext,
if (restrict_authenticated)
return ENOENT;
- delegated = k5alloc((s4uctx->count + 1) * sizeof(krb5_principal), &code);
+ delegated = k5calloc(s4uctx->count + 1, sizeof(krb5_principal), &code);
if (delegated == NULL)
return code;
@@ -511,7 +511,7 @@ s4u2proxy_internalize(krb5_context kcontext,
else if (count > 0) {
int i;
- delegated = k5alloc((count + 1) * sizeof(krb5_principal), &code);
+ delegated = k5calloc(count + 1, sizeof(krb5_principal), &code);
if (delegated == NULL)
goto cleanup;
diff --git a/src/lib/krb5/krb/send_tgs.c b/src/lib/krb5/krb/send_tgs.c
index 9a7c261dd6..cd56366cb2 100644
--- a/src/lib/krb5/krb/send_tgs.c
+++ b/src/lib/krb5/krb/send_tgs.c
@@ -232,7 +232,7 @@ k5_make_tgs_req(krb5_context context,
for (count = 0; in_padata != NULL && in_padata[count] != NULL; count++);
/* Construct a padata array for the request, beginning with the ap-req. */
- padata = k5alloc((count + 2) * sizeof(krb5_pa_data *), &ret);
+ padata = k5calloc(count + 2, sizeof(krb5_pa_data *), &ret);
if (padata == NULL)
goto cleanup;
padata[0] = k5alloc(sizeof(krb5_pa_data), &ret);
diff --git a/src/lib/krb5/os/expand_path.c b/src/lib/krb5/os/expand_path.c
index 3d23849ba4..f14e9acd81 100644
--- a/src/lib/krb5/os/expand_path.c
+++ b/src/lib/krb5/os/expand_path.c
@@ -477,7 +477,7 @@ k5_expand_path_tokens_extra(krb5_context context, const char *path_in,
/* Get extra tokens. */
if (nargs > 0) {
- extra_tokens = k5alloc((nargs + 1) * sizeof(char *), &ret);
+ extra_tokens = k5calloc(nargs + 1, sizeof(char *), &ret);
if (extra_tokens == NULL)
goto cleanup;
va_start(ap, path_out);
diff --git a/src/lib/krb5/os/localauth.c b/src/lib/krb5/os/localauth.c
index 82fc1f9508..81ab5d8ab5 100644
--- a/src/lib/krb5/os/localauth.c
+++ b/src/lib/krb5/os/localauth.c
@@ -155,7 +155,7 @@ load_localauth_modules(krb5_context context)
/* Allocate a large enough list of handles. */
for (count = 0; modules[count] != NULL; count++);
- list = k5alloc((count + 1) * sizeof(*list), &ret);
+ list = k5calloc(count + 1, sizeof(*list), &ret);
if (list == NULL)
goto cleanup;