• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Possible memory leak:


      CString cs("Mark IIV");
      DisplayMethod(cs.AllocSysString());

...do I have to do anything with cs to free is due to memory leaks or is that ok?
0
Unimatrix_001
Asked:
Unimatrix_001
1 Solution
 
mnashadkaCommented:
Actually, cs is fine, but the new BSTR that you send to DisplayMethod must be freed with ::SysFreeString.  You'll either want to get the BSTR beforehand so that you can call ::SysFreeString after calling DisplayMethod, or call ::SysFreeString in your DisplayMethod function (if that's an option).  Good luck.
0
 
Unimatrix_001Author Commented:
Thank you :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now