From ad2f50316fd17489cfee9df98fed03d1bb1232db Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Wed, 5 Feb 2014 17:17:55 +0100 Subject: [PATCH] Fix memory leak in Nettle crypto backend. --- lib/crypto_backend/crypto_nettle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/crypto_backend/crypto_nettle.c b/lib/crypto_backend/crypto_nettle.c index 21820d9b..2fcbae27 100644 --- a/lib/crypto_backend/crypto_nettle.c +++ b/lib/crypto_backend/crypto_nettle.c @@ -265,8 +265,8 @@ int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length) int crypt_hmac_destroy(struct crypt_hmac *ctx) { memset(ctx->key, 0, ctx->key_length); - memset(ctx, 0, sizeof(*ctx)); free(ctx->key); + memset(ctx, 0, sizeof(*ctx)); free(ctx); return 0; }