From 4f7a121a63ae3a9496db2b8be4cb4d5f357f38d2 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Tue, 20 Oct 2009 02:07:22 +0000 Subject: [PATCH] Fix memory leaks in enc-perf work git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22949 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/builtin/arcfour/arcfour.c | 1 + src/lib/crypto/krb/key.c | 2 ++ src/lib/crypto/openssl/arcfour/arcfour.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/lib/crypto/builtin/arcfour/arcfour.c b/src/lib/crypto/builtin/arcfour/arcfour.c index 150a7aa06..ad7ccec0b 100644 --- a/src/lib/crypto/builtin/arcfour/arcfour.c +++ b/src/lib/crypto/builtin/arcfour/arcfour.c @@ -186,6 +186,7 @@ krb5_arcfour_encrypt(const struct krb5_enc_provider *enc, free(d3.data); free(salt.data); free(plaintext.data); + krb5_k_free_key(NULL, k3key); return (ret); } diff --git a/src/lib/crypto/krb/key.c b/src/lib/crypto/krb/key.c index 4ea72b478..d6adcba74 100644 --- a/src/lib/crypto/krb/key.c +++ b/src/lib/crypto/krb/key.c @@ -77,10 +77,12 @@ krb5_k_free_key(krb5_context context, krb5_key key) /* Free the derived key cache. */ while ((dk = key->derived) != NULL) { key->derived = dk->next; + free(dk->constant.data); krb5_k_free_key(context, dk->dkey); free(dk); } krb5int_c_free_keyblock_contents(context, &key->keyblock); + free(key); } /* Retrieve a copy of the keyblock from a krb5_key. */ diff --git a/src/lib/crypto/openssl/arcfour/arcfour.c b/src/lib/crypto/openssl/arcfour/arcfour.c index 2c89b99b8..719bfaabd 100644 --- a/src/lib/crypto/openssl/arcfour/arcfour.c +++ b/src/lib/crypto/openssl/arcfour/arcfour.c @@ -187,6 +187,7 @@ krb5_arcfour_encrypt(const struct krb5_enc_provider *enc, free(d3.data); free(salt.data); free(plaintext.data); + krb5_k_free_key(NULL, k3key); return (ret); } -- 2.26.2