Przeglądaj źródła

Memory leak

Source commit: 87d87fcd024f29d77298b0958f9aa5aa27ca5e01
Martin Prikryl 7 lat temu
rodzic
commit
7097d1dac9
1 zmienionych plików z 8 dodań i 0 usunięć
  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()))
   {