From ca6c587cc9da51235b125a97e841fa786aaad7ff Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 16 Apr 2019 10:18:43 -0400 Subject: [PATCH] Prevent double free of RC4 context Signed-off-by: Simo Sorce --- plugins/digestmd5.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/digestmd5.c b/plugins/digestmd5.c index f184c164..df35093d 100644 --- a/plugins/digestmd5.c +++ b/plugins/digestmd5.c @@ -1224,8 +1224,14 @@ static void free_rc4(context_t *text) { /* free rc4 context structures */ - if(text->cipher_enc_context) text->utils->free(text->cipher_enc_context); - if(text->cipher_dec_context) text->utils->free(text->cipher_dec_context); + if (text->cipher_enc_context) { + text->utils->free(text->cipher_enc_context); + text->cipher_enc_context = NULL; + } + if (text->cipher_dec_context) { + text->utils->free(text->cipher_dec_context); + text->cipher_dec_context = NULL; + } } static int init_rc4(context_t *text,