aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Config.cpp4
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);