Example:
StringSource(pMessage, nMessageSize, true, newStreamTransformationFilter(aes, newStringSink(sEncryptedSegment)));
The code above works, but I was unsure about a memory leak, so I tried putting things on the stack:
StringSinkoSink(sEncryptedSegment); StreamTransformationFilteroFilter(aes, &oSink); StringSource(pMessage, nMessageSize, true, &oFilter);
The revised code crashes with a segmentation fault.
Is there a memory leak with the first form above? If so, how should it be revised to avoid that? Thanks.
Rod
I have not read the source, but from your eksample it is clear the
Stringsource expects to "own" the passed StreamTransformationFilter
object and deletes it in its own destruktor.
Likewise the StreamTransformationFilter expects to "own" the StringSink
object.
The error in the second example arises from the Stringsource trying
to delete an object on the stack.
Best regards
KenR
I have not read the source, but from your eksample it is clear the
Stringsource expects to "own" the passed StreamTransformationFilter
object and deletes it in its own destruktor.
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-user...@googlegroups.com.
More information about Crypto++ and this group is available at http://www.cryptopp.com.
Great, thanks! It's generally concerning when you see a "new" without a corresponding "delete", it might be helpful to have this behavior (implicit destruction of objects passed into the constructor) documented in the wiki. Thanks for your help.