Fix possible leaks in stdext::format

This commit is contained in:
Eduardo Bart
2013-02-05 20:00:28 -02:00
parent dcd6249e8f
commit cf77df05ca
6 changed files with 9 additions and 8 deletions

View File

@@ -111,7 +111,7 @@ void crashHandler(int signum, siginfo_t* info, void* secret)
fout << ss.str();
fout << "\n";
fout.close();
g_logger.info(stdext::format("Crash report saved to file %s", fileName.c_str()));
g_logger.info(stdext::format("Crash report saved to file %s", fileName));
} else
g_logger.error("Failed to save crash report!");

View File

@@ -111,13 +111,13 @@ LONG CALLBACK ExceptionHandler(LPEXCEPTION_POINTERS e)
SymInitialize(GetCurrentProcess(), 0, TRUE);
std::stringstream ss;
ss << "== application crashed\n";
ss << stdext::format("app name: %s\n", g_app.getName().c_str());
ss << stdext::format("app version: %s\n", g_app.getVersion().c_str());
ss << stdext::format("app name: %s\n", g_app.getName());
ss << stdext::format("app version: %s\n", g_app.getVersion());
ss << stdext::format("build compiler: %s\n", BUILD_COMPILER);
ss << stdext::format("build date: %s\n", __DATE__);
ss << stdext::format("build type: %s\n", BUILD_TYPE);
ss << stdext::format("build revision: %s (%s)\n", BUILD_REVISION, BUILD_COMMIT);
ss << stdext::format("crash date: %s\n", stdext::date_time_string().c_str());
ss << stdext::format("crash date: %s\n", stdext::date_time_string());
ss << stdext::format("exception: %s (0x%08lx)\n", getExceptionName(e->ExceptionRecord->ExceptionCode), e->ExceptionRecord->ExceptionCode);
ss << stdext::format("exception address: 0x%08lx\n", (long unsigned int)e->ExceptionRecord->ExceptionAddress);
ss << stdext::format(" backtrace:\n");

View File

@@ -236,7 +236,7 @@ void WIN32Window::terminate()
}
if(m_instance) {
if(!UnregisterClassA(g_app.getCompactName().c_str(), m_instance))
if(!UnregisterClassA(g_app.getCompactName(), m_instance))
g_logger.error("UnregisterClassA failed");
m_instance = NULL;
}
@@ -262,7 +262,7 @@ void WIN32Window::internalCreateWindow()
wc.hCursor = m_defaultCursor;
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_app.getCompactName().c_str();
wc.lpszClassName = g_app.getCompactName();
if(!RegisterClassA(&wc))
g_logger.fatal("Failed to register the window class.");