summaryrefslogtreecommitdiffstats
path: root/src/lib/krb5/krb
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2013-03-28 16:43:30 -0400
committerGreg Hudson <ghudson@mit.edu>2013-03-29 01:59:33 -0400
commit61ab05d3b647971f2fc9481e7498176626a13707 (patch)
treeabad3ac95f03d1d571d397206cf849a8c1c00bc0 /src/lib/krb5/krb
parentfd557fc3de99f63b37ae78a0f43968c162524baa (diff)
downloadkrb5-61ab05d3b647971f2fc9481e7498176626a13707.tar.gz
krb5-61ab05d3b647971f2fc9481e7498176626a13707.tar.xz
krb5-61ab05d3b647971f2fc9481e7498176626a13707.zip
Using k5-int.h data helpers for some functions
Use empty_data(), alloc_data(), and make_data() in some appropriate places. This has the side effect of initializing the krb5_data magic field, which can placate debugging tools.
Diffstat (limited to 'src/lib/krb5/krb')
-rw-r--r--src/lib/krb5/krb/pr_to_salt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/krb5/krb/pr_to_salt.c b/src/lib/krb5/krb/pr_to_salt.c
index 416c1efed0..53fc0ae240 100644
--- a/src/lib/krb5/krb/pr_to_salt.c
+++ b/src/lib/krb5/krb/pr_to_salt.c
@@ -42,11 +42,9 @@ principal2salt_internal(krb5_context context,
krb5_int32 nelem;
register int i;
- if (pr == 0) {
- ret->length = 0;
- ret->data = 0;
+ *ret = empty_data();
+ if (pr == NULL)
return 0;
- }
nelem = krb5_princ_size(context, pr);
@@ -56,8 +54,7 @@ principal2salt_internal(krb5_context context,
for (i = 0; i < (int) nelem; i++)
size += krb5_princ_component(context, pr, i)->length;
- ret->length = size;
- if (!(ret->data = malloc (size)))
+ if (alloc_data(ret, size))
return ENOMEM;
if (use_realm) {