浏览代码

Memory leak

Source commit: 87d87fcd024f29d77298b0958f9aa5aa27ca5e01
Martin Prikryl 7 年之前
父节点
当前提交
7097d1dac9
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      source/core/Cryptography.cpp

+ 8 - 0
source/core/Cryptography.cpp

@@ -651,10 +651,18 @@ TEncryption::TEncryption(const RawByteString & Key)
     FContext = call_aes_make_context();
     aes_set_encrypt_key(reinterpret_cast<unsigned char *>(FKey.c_str()), FKey.Length(), FContext);
   }
+  else
+  {
+    FContext = NULL;
+  }
 }
 //---------------------------------------------------------------------------
 TEncryption::~TEncryption()
 {
+  if (FContext != NULL)
+  {
+    call_aes_free_context(FContext);
+  }
   Shred(FKey);
   if ((FInputHeader.Length() > 0) && (FInputHeader.Length() < GetOverhead()))
   {