It's not a good idea to store the pointers you get from c_str() calls. It is a much better idea to make a copy of the string using _tcscpy.
As to why it fails - because the method is declared like this:
wstring getName()
What you get when you call it is a copy of m_sName - which than disappears pretty quickly. And that's why the pointer you get from c_str() is no longer valid and strange things may happen (it may even work in release for a while and than fail out of the blue). If you want the actual m_sName you would need to define the function like this:
wstring& getName()
You can even have both functions in your code and than compare the pointers c_str() returns - see the difference?
But as I said at the start of this post - it is NOT a good idea to use the c_str() returned pointer. Always, always make a copy for a safer and better working programs :)
Best of luck!!