From 675e2774696303b1a1d6363dfd695d635d2e6cb7 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 28 Dec 2006 02:05:20 +0000 Subject: [PATCH] * copy_data.c (krb5_copy_data): Use krb5int_copy_data_contents git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19019 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/krb/copy_data.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib/krb5/krb/copy_data.c b/src/lib/krb5/krb/copy_data.c index aed2e863b..ab419f28a 100644 --- a/src/lib/krb5/krb/copy_data.c +++ b/src/lib/krb5/krb/copy_data.c @@ -36,6 +36,7 @@ krb5_error_code KRB5_CALLCONV krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata) { krb5_data *tempdata; + krb5_error_code retval; if (!indata) { *outdata = 0; @@ -45,16 +46,12 @@ krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdat if (!(tempdata = (krb5_data *)malloc(sizeof(*tempdata)))) return ENOMEM; - tempdata->length = indata->length; - if (tempdata->length) { - if (!(tempdata->data = malloc(tempdata->length))) { - krb5_xfree(tempdata); - return ENOMEM; - } - memcpy((char *)tempdata->data, (char *)indata->data, tempdata->length); - } else - tempdata->data = 0; - tempdata->magic = KV5M_DATA; + retval = krb5int_copy_data_contents(context, indata, tempdata); + if (retval) { + krb5_xfree(tempdata); + return retval; + } + *outdata = tempdata; return 0; } -- 2.26.2