mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-25 07:10:00 -06:00
fix implementation of CoTaskMemRealloc, as it can decide to move the buffer elsewhere, we have to account for that
This commit is contained in:
@ -139,7 +139,9 @@ FILE* GetConfigFile(const char* fileName, const char* permissions)
|
|||||||
if (res != fnlen) { delete[] wfileName; return NULL; } // checkme?
|
if (res != fnlen) { delete[] wfileName; return NULL; } // checkme?
|
||||||
|
|
||||||
int pos = wcslen(appDataPath);
|
int pos = wcslen(appDataPath);
|
||||||
CoTaskMemRealloc(appDataPath, (pos+wcslen(appdir)+fnlen+1)*sizeof(WCHAR));
|
void* ptr = CoTaskMemRealloc(appDataPath, (pos+wcslen(appdir)+fnlen+1)*sizeof(WCHAR));
|
||||||
|
if (!ptr) { delete[] wfileName; return NULL; } // oh well
|
||||||
|
appDataPath = (PWSTR)ptr;
|
||||||
|
|
||||||
wcscpy(&appDataPath[pos], appdir); pos += wcslen(appdir);
|
wcscpy(&appDataPath[pos], appdir); pos += wcslen(appdir);
|
||||||
wcscpy(&appDataPath[pos], wfileName);
|
wcscpy(&appDataPath[pos], wfileName);
|
||||||
|
Reference in New Issue
Block a user