Browse Source

Fix free/delete[] misusage

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.1
falkTX 2 years ago
parent
commit
efbebc59f1
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 8 additions and 8 deletions
  1. +7
    -7
      source/backend/engine/CarlaEngineNative.cpp
  2. +1
    -1
      source/utils/CarlaPipeUtils.cpp

+ 7
- 7
source/backend/engine/CarlaEngineNative.cpp View File

@@ -1973,13 +1973,13 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept


if (filename != nullptr && std::strcmp(filename, "(null)") == 0) if (filename != nullptr && std::strcmp(filename, "(null)") == 0)
{ {
delete[] filename;
std::free(const_cast<char*>(filename));
filename = nullptr; filename = nullptr;
} }


if (std::strcmp(name, "(null)") == 0) if (std::strcmp(name, "(null)") == 0)
{ {
delete[] name;
std::free(const_cast<char*>(name));
name = nullptr; name = nullptr;
} }


@@ -1987,10 +1987,10 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept
filename, name, label, uniqueId, nullptr, options); filename, name, label, uniqueId, nullptr, options);


if (filename != nullptr) if (filename != nullptr)
delete[] filename;
std::free(const_cast<char*>(filename));
if (name != nullptr) if (name != nullptr)
delete[] name;
delete[] label;
std::free(const_cast<char*>(name));
std::free(const_cast<char*>(label));


fEngine->reloadFromUI(); fEngine->reloadFromUI();
} }
@@ -2268,8 +2268,8 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept
if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId)) if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId))
plugin->setCustomData(type, key, value, true); plugin->setCustomData(type, key, value, true);


delete[] type;
delete[] key;
std::free(const_cast<char*>(type));
std::free(const_cast<char*>(key));
} }
else if (std::strcmp(msg, "set_chunk_data") == 0) else if (std::strcmp(msg, "set_chunk_data") == 0)
{ {


+ 1
- 1
source/utils/CarlaPipeUtils.cpp View File

@@ -686,7 +686,7 @@ void CarlaPipeCommon::idlePipe(const bool onlyOnce) noexcept


pData->isReading = false; pData->isReading = false;


delete[] msg;
std::free(const_cast<char*>(msg));


if (onlyOnce || pData->pipeRecv == INVALID_PIPE_VALUE) if (onlyOnce || pData->pipeRecv == INVALID_PIPE_VALUE)
break; break;


Loading…
Cancel
Save