Home Forums ActiveX components Xceed Encryption for ActiveX Memory leak when using VC++ MFC.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #43022 |

    COleVariant’s assignment operator (operator ‘=’) does not attach the variant to the instance, but rather makes a copy of the variant. Thus the following call is losing the returned variant, and vaData only holds (and will free) a copy of it:

    vaData = XceedEncryption.ReadFile ( _T ( “C:\\Test” ), 0, 0, efpDecrypt, TRUE, &ovBytesRead );

    To correctly use COleVariants, one must use its “Attach” method instead of its assignment operator, like this:

    vaData.Attach( XceedEncryption.ReadFile ( _T ( “C:\\Test” ), 0, 0, efpDecrypt, TRUE, &ovBytesRead ) );

    Imported from legacy forums. Posted by Xceed admin (had 1782 views)

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.