From e7cff4bc4306a481b4d04ffa17a2916aebb4756b Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Sat, 9 May 2009 22:40:22 +0300 Subject: [PATCH] Apply #296 ([PATCH] cppcheck leak memory when -j option uses) http://apps.sourceforge.net/trac/cppcheck/ticket/296 --- src/threadexecutor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/threadexecutor.cpp b/src/threadexecutor.cpp index b3eb95426..831a11ee3 100644 --- a/src/threadexecutor.cpp +++ b/src/threadexecutor.cpp @@ -191,9 +191,13 @@ void ThreadExecutor::writeToPipe(char type, const std::string &data) std::memcpy(&(out[1+sizeof(len)]), data.c_str(), len); if (write(_pipe[1], out, len + 1 + sizeof(len)) <= 0) { + delete [] out; + out = 0; std::cerr << "#### ThreadExecutor::writeToPipe, Failed to write to pipe" << std::endl; exit(0); } + + delete [] out; } void ThreadExecutor::reportOut(const std::string &outmsg)