From f5822b5ed3ecf047d5f7c09a73224bc4cf69542f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 25 May 2023 11:36:43 +0200 Subject: [PATCH] compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit like dbcon/joblist/batchprimitiveprocessor-jl.cpp:893:54: error: pointer used after ‘void operator delete [](void*, std::size_t)’ [-Werror=use-after-free] 893 | joinResults.reset(new vector[8192]); | ^ --- dbcon/joblist/batchprimitiveprocessor-jl.cpp | 3 ++- dbcon/joblist/diskjoinstep.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dbcon/joblist/batchprimitiveprocessor-jl.cpp b/dbcon/joblist/batchprimitiveprocessor-jl.cpp index 0228863f1..b7fcaec02 100644 --- a/dbcon/joblist/batchprimitiveprocessor-jl.cpp +++ b/dbcon/joblist/batchprimitiveprocessor-jl.cpp @@ -890,7 +890,8 @@ void BatchPrimitiveProcessorJL::getRowGroupData(ByteStream& in, vector* if (joinResults.get() == NULL) { - joinResults.reset(new vector[8192]); + auto v = new vector[8192]; + joinResults.reset(v); tJoiners[j]->setPMJoinResults(joinResults, threadID); } diff --git a/dbcon/joblist/diskjoinstep.cpp b/dbcon/joblist/diskjoinstep.cpp index aa84deea8..6783cee87 100644 --- a/dbcon/joblist/diskjoinstep.cpp +++ b/dbcon/joblist/diskjoinstep.cpp @@ -359,7 +359,8 @@ void DiskJoinStep::joinFcn() Row l_largeRow; Row l_joinFERow, l_outputRow, baseRow; vector > joinMatches; - std::shared_ptr smallRowTemplates(new Row[1]); + auto new_row = new Row[1]; + std::shared_ptr smallRowTemplates(new_row); vector> joiners; std::shared_ptr[]> colMappings, fergMappings; boost::scoped_array > smallNullMem;