From f161ac6182a3a2af14254f9c94de1357317c7976 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Tue, 16 Apr 2013 17:19:34 -0500 Subject: [PATCH] Fix memory leak. Oops :(. Found by KindOne on IRC. Thanks! --- modules/sasl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/sasl.cpp b/modules/sasl.cpp index 1fe37b48..202d64d3 100644 --- a/modules/sasl.cpp +++ b/modules/sasl.cpp @@ -315,6 +315,8 @@ public: unsigned char randbytes[16]; if (!RAND_bytes(randbytes, padlen)) { DEBUG("sasl: DH-AES: Unable to pad"); + free(encrypted_userpass); + free(plaintext_userpass); return false; } memcpy(ptr, randbytes, padlen); @@ -326,6 +328,8 @@ public: unsigned char iv[16], iv_copy[16]; if (!RAND_bytes(iv, sizeof (iv))) { DEBUG("sasl: DH-AES: Unable to create IV"); + free(encrypted_userpass); + free(plaintext_userpass); return false; } memcpy(iv_copy, iv, sizeof(iv));