From efbebc59f11429607ebe7c1a00e8da013644b5a7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Sep 2022 19:24:54 +0100 Subject: [PATCH] Fix free/delete[] misusage Signed-off-by: falkTX --- source/backend/engine/CarlaEngineNative.cpp | 14 +++++++------- source/utils/CarlaPipeUtils.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index d5ad446f5..0f476eb13 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -1973,13 +1973,13 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept if (filename != nullptr && std::strcmp(filename, "(null)") == 0) { - delete[] filename; + std::free(const_cast(filename)); filename = nullptr; } if (std::strcmp(name, "(null)") == 0) { - delete[] name; + std::free(const_cast(name)); name = nullptr; } @@ -1987,10 +1987,10 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept filename, name, label, uniqueId, nullptr, options); if (filename != nullptr) - delete[] filename; + std::free(const_cast(filename)); if (name != nullptr) - delete[] name; - delete[] label; + std::free(const_cast(name)); + std::free(const_cast(label)); fEngine->reloadFromUI(); } @@ -2268,8 +2268,8 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId)) plugin->setCustomData(type, key, value, true); - delete[] type; - delete[] key; + std::free(const_cast(type)); + std::free(const_cast(key)); } else if (std::strcmp(msg, "set_chunk_data") == 0) { diff --git a/source/utils/CarlaPipeUtils.cpp b/source/utils/CarlaPipeUtils.cpp index 096b66479..bb9696223 100644 --- a/source/utils/CarlaPipeUtils.cpp +++ b/source/utils/CarlaPipeUtils.cpp @@ -686,7 +686,7 @@ void CarlaPipeCommon::idlePipe(const bool onlyOnce) noexcept pData->isReading = false; - delete[] msg; + std::free(const_cast(msg)); if (onlyOnce || pData->pipeRecv == INVALID_PIPE_VALUE) break;