Memory Leak

11 views
Skip to first unread message

Galo Vinueza S.

unread,
Feb 25, 2012, 9:38:07 AM2/25/12
to Crypto++ Users
Hello, i have a memory leak, using VS 2008 and a static version of the
library, the code is as follow:

//make room for the biggest 4096 bits
BYTE bPriv[2400];
BYTE bPub[600];

DWORD dwPubSize = 0;
DWORD dwPrivSize = 0;

ZeroMemory(bPriv, 2400);
ZeroMemory(bPub, 600);

try
{
ArraySink arrPriv(bPriv, 2400);
ArraySink arrPub(bPub, 600);

AutoSeededRandomPool _random;

RSAES_OAEP_SHA_Decryptor _priv(_random, nKeyLength);
_priv.DEREncode(arrPriv);

RSAES_OAEP_SHA_Encryptor _pub(_priv);
_pub.DEREncode(arrPub);

dwPubSize = (DWORD)arrPub.TotalPutLength();
dwPrivSize = (DWORD)arrPriv.TotalPutLength();
}
catch (...){}
....some more code using the bPriv and bPub buffers....

after executing this code, i end up with a memory leak, PLEASE if i'm
doing something wrong here, let me know.
Saludos, Galo.

Jeffrey Walton

unread,
Feb 26, 2012, 2:29:59 AM2/26/12
to Crypto++ Users
Reply all
Reply to author
Forward
0 new messages