From 80c866a4a7f775dfc95efd9610793fac8577f9c9 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Mon, 21 Sep 2009 09:52:28 -0700 Subject: [PATCH] fix valgrind problems --- lib/krb5/aes-test.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/krb5/aes-test.c b/lib/krb5/aes-test.c index 54e0237e0..f130c402b 100644 --- a/lib/krb5/aes-test.c +++ b/lib/krb5/aes-test.c @@ -385,11 +385,12 @@ krb_enc_iov2(krb5_context context, */ /* padding turn into data */ - p = emalloc(iov[1].data.length + iov[2].data.length); + p = q = emalloc(iov[1].data.length + iov[2].data.length); + + memcpy(q, iov[1].data.data, iov[1].data.length); + q += iov[1].data.length; + memcpy(q, iov[2].data.data, iov[2].data.length); - memcpy(p, iov[1].data.data, iov[1].data.length); - memcpy(p + iov[1].data.length, iov[2].data.data, iov[2].data.length); - free(iov[1].data.data); free(iov[2].data.data); @@ -401,6 +402,7 @@ krb_enc_iov2(krb5_context context, ret = krb5_decrypt_iov_ivec(context, crypto, usage, iov, sizeof(iov)/sizeof(iov[0]), NULL); + free(iov[3].data.data); if (ret) krb5_err(context, 1, ret, "decrypt iov failed: %d", ret); @@ -797,6 +799,8 @@ iov_test(krb5_context context) krb5_crypto_destroy(context, crypto); + krb5_free_keyblock_contents(context, &key); + return 0; } -- 2.11.4.GIT