I have a COM code where i use BSTR.
In that the application crashes when using ::SysFreeString()
However the same works in WINDOWS2003, WIN7, WINXP etc.
Any idea on what is causing the problem or what could be wrong. Sample code is as below
class CFoo::IUser
{
BSTR UserName;
}
HRESULT CBar::FooMethod(VARIANT *vOut)
{
//create interface, variant and fill the object.
BSTR bstrname = ::SysAllocString(_T("Username"));
//use bstrname to fill interface structure.
//finished using now deallocate memory
::SysFreeString(bstrname); // crashing here only in windows 2008 R2
}