I see that most of the examples use new.
I wrote my code to not use new:

AES::Encryption aesEncryption((const byte *)encKey.constData(), 
AES::DEFAULT_KEYLENGTH);

CFB_Mode<AES>::Encryption e;

e.SetKeyWithIV((const byte *)encKey.constData(), 16, (const 
byte*)iv.constData());


FileSink   sink((const char *)outFilename.toLocal8Bit().constData());

StreamTransformationFilter aes_enc(e, &sink);

FileSource src((const char *)inFilename.toLocal8Bit().constData(), true, 
&aes_enc);



My code crashes. with the message "pointer being freed was not allocated" 
Indeed it was not allocated. But why is cryptopp attempting to mange memory 
that it did not allocate? I always thought you _only_ manage the memory for 
objects you allocate, because you'll wind up in this exact situation. I 
figured that the example code would leak 2 objects. ex: StringSource 
s(cipher, true, new HexEncoder(new StringSink(encoded) ) ); but that this 
was ok because it was just a demo. 

What do I need to learn about cryptopp's memory management?





-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to