From 2b1f67289045ed0de75d1aecc9d0a3ba5094ea95 Mon Sep 17 00:00:00 2001 From: hama Date: Tue, 6 Jan 2015 01:47:25 +0100 Subject: [PATCH] valgrind clean --- base/ReByteBuffer.cpp | 2 +- os/ReDirTools.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/base/ReByteBuffer.cpp b/base/ReByteBuffer.cpp index 6e6a393..36ebc73 100644 --- a/base/ReByteBuffer.cpp +++ b/base/ReByteBuffer.cpp @@ -258,7 +258,7 @@ void ReByteBuffer::ensureSize(size_t size){ memcpy(buffer, m_buffer, m_length); buffer[m_length] = '\0'; if (m_buffer != m_primaryBuffer) - delete m_buffer; + delete[] m_buffer; m_buffer = buffer; m_capacity = size; } diff --git a/os/ReDirTools.cpp b/os/ReDirTools.cpp index 7137fb3..0a3b117 100644 --- a/os/ReDirTools.cpp +++ b/os/ReDirTools.cpp @@ -104,7 +104,7 @@ ReDirOptions::ReDirOptions(const char* usage[], const char* examples[]) : * Destructor. */ ReDirOptions::~ReDirOptions(){ - delete m_compoundUsage; + delete[] m_compoundUsage; } /** * Initializes the compound usage message array. @@ -112,7 +112,7 @@ ReDirOptions::~ReDirOptions(){ * @param size the size of the array: size = (field1 + field2 + ...) * sizeof(const char*) */ void ReDirOptions::initCompoundUsage(size_t size){ - delete m_compoundUsage; + delete[] m_compoundUsage; int count = size / sizeof m_compoundUsage[0]; m_compoundUsage = new const char*[count]; memset(m_compoundUsage, 0, size); @@ -914,7 +914,9 @@ void ReDirBatch::createBatch(int argc, const char* argv[]){ if (arguments.length() + script.length() == 0) help(i18n("one of the option must be set: -a (--arguments) or -c (--script)")); bool verbose = ! m_programArgs.getBool("quiet"); - bool isExe = ! m_programArgs.getBool("isexe"); +#if defined __WIN32__ + bool isExe = m_programArgs.getBool("isexe"); +#endif setFilterFromProgramArgs(filter); if (m_programArgs.getArgCount() == 0) help(i18n("no arguments given (missing path)")); @@ -944,8 +946,10 @@ void ReDirBatch::createBatch(int argc, const char* argv[]){ } if (script.length() > 0){ line.setLength(0); +#if defined __WIN32__ if (! isExe) line.append("call "); +#endif line.append(script).append(" ").append(delim, -1); line.append(entry->m_path).append(entry->node(), -1); line.append(delim, -1); -- 2.39.5