mirror of
https://github.com/reactos/reactos.git
synced 2026-06-02 17:31:23 +08:00
[ROSAUTOTEST] Fix invalid use of delete operator
Fixes GCC 13 warning:
C:/ReactOS/reactos/modules/rostests/rosautotest/tools.cpp: In function 'std::wstring AsciiToUnicode(const char*)':
C:/ReactOS/reactos/modules/rostests/rosautotest/tools.cpp:231:12: error: 'void operator delete(void*)' called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete]
231 | delete UnicodeString;
| ^~~~~~~~~~~~~
This commit is contained in:
@@ -228,7 +228,7 @@ AsciiToUnicode(const char* AsciiString)
|
||||
UnicodeString = new WCHAR[Length];
|
||||
MultiByteToWideChar(CP_ACP, 0, AsciiString, -1, UnicodeString, Length);
|
||||
ReturnString = UnicodeString;
|
||||
delete UnicodeString;
|
||||
delete[] UnicodeString;
|
||||
|
||||
return ReturnString;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ UnicodeToAscii(PCWSTR UnicodeString)
|
||||
AsciiString = new char[Length];
|
||||
WideCharToMultiByte(CP_ACP, 0, UnicodeString, -1, AsciiString, Length, NULL, NULL);
|
||||
ReturnString = AsciiString;
|
||||
delete AsciiString;
|
||||
delete[] AsciiString;
|
||||
|
||||
return ReturnString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user