• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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