mirror of
https://github.com/rapid7/metasploit-payloads
synced 2025-03-24 18:16:24 +01:00
fix for memory leak
This commit is contained in:
parent
e8461c1a83
commit
71762fe778
@ -98,14 +98,14 @@ DWORD decrypt_packet(Remote* remote, Packet** packet, LPBYTE buffer, DWORD buffe
|
||||
}
|
||||
|
||||
// decrypt!
|
||||
if (!CryptSetKeyParam(remote->enc_ctx->aes_key, KP_IV, iv, 0))
|
||||
if (!CryptSetKeyParam(dupKey, KP_IV, iv, 0))
|
||||
{
|
||||
result = GetLastError();
|
||||
vdprintf("[DEC] Failed to set IV: %d (%x)", result, result);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!CryptDecrypt(remote->enc_ctx->aes_key, 0, TRUE, 0, encryptedData, &encryptedSize))
|
||||
if (!CryptDecrypt(dupKey, 0, TRUE, 0, encryptedData, &encryptedSize))
|
||||
{
|
||||
result = GetLastError();
|
||||
vdprintf("[DEC] Failed to decrypt: %d (%x)", result, result);
|
||||
@ -162,6 +162,10 @@ DWORD decrypt_packet(Remote* remote, Packet** packet, LPBYTE buffer, DWORD buffe
|
||||
packet_destroy(localPacket);
|
||||
}
|
||||
}
|
||||
if (dupKey != 0)
|
||||
{
|
||||
CryptDestroyKey(dupKey);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user