Changeset 100509 in vbox for trunk/src/VBox
- Timestamp:
- Jul 11, 2023 11:23:47 AM (20 months ago)
- svn:sync-xref-src-repo-rev:
- 158294
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/SharedClipboard/ClipboardStreamImpl-win.cpp
r100507 r100509 291 291 case STATFLAG_DEFAULT: 292 292 { 293 /** @todo r=bird: This is using the wrong allocator. According to MSDN the 294 * caller will pass this to CoTaskMemFree, so we should use CoTaskMemAlloc to 295 * allocate it. */ 296 int rc2 = RTStrToUtf16(m_strPath.c_str(), &pStatStg->pwcsName); 297 if (RT_FAILURE(rc2)) 298 hr = E_FAIL; 293 size_t const cchLen = m_strPath.length() + 1 /* Include terminator */; 294 pStatStg->pwcsName = (LPOLESTR)CoTaskMemAlloc(cchLen * sizeof(RTUTF16)); 295 if (pStatStg->pwcsName) 296 { 297 PRTUTF16 pwszStr; 298 int rc2 = RTStrToUtf16(m_strPath.c_str(), &pwszStr); 299 if (RT_SUCCESS(rc2)) 300 { 301 memcpy(pStatStg->pwcsName, pwszStr, cchLen * sizeof(RTUTF16)); 302 RTUtf16Free(pwszStr); 303 pwszStr = NULL; 304 } 305 306 if (RT_FAILURE(rc2)) 307 { 308 CoTaskMemFree(pStatStg->pwcsName); 309 pStatStg->pwcsName = NULL; 310 hr = E_UNEXPECTED; 311 } 312 } 313 else 314 hr = E_OUTOFMEMORY; 299 315 break; 300 316 }
Note:
See TracChangeset
for help on using the changeset viewer.