On 9/3/2010 13:25, Mariusz PluciĆski wrote:
hr = IXMLDOMElement_get_text(lpXMLElement,&bstrValue);if(SUCCEEDED(hr)){nValueLen = SysStringLen(bstrValue)+1;GameData->sName = CoTaskMemAlloc(nValueLen*sizeof(WCHAR));if(GameData->sName == NULL)hr = E_OUTOFMEMORY;if(SUCCEEDED(hr))lstrcpynW(GameData->sName, bstrValue, nValueLen);SysFreeString(bstrValue);}
Maybe it's better to store it as BSTR to avoid such checks/allocations.