diff options
author | StapleButter <thetotalworm@gmail.com> | 2018-10-27 14:44:39 +0200 |
---|---|---|
committer | StapleButter <thetotalworm@gmail.com> | 2018-10-27 14:44:39 +0200 |
commit | 658856b256d4e6c255a25ecdd6d1a37d3626877b (patch) | |
tree | 87c1b1b5e24b7372107c9b949c52aec4eefba5cf /src | |
parent | a4339daade79e942208c2f3cf3c42fa63330f9fc (diff) |
fix implementation of CoTaskMemRealloc, as it can decide to move the buffer elsewhere, we have to account for that
Diffstat (limited to 'src')
-rw-r--r-- | src/Config.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Config.cpp b/src/Config.cpp index be9e53f..fea92e9 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -139,7 +139,9 @@ FILE* GetConfigFile(const char* fileName, const char* permissions) if (res != fnlen) { delete[] wfileName; return NULL; } // checkme? 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], wfileName); |