From 21da3bca63c8a5c5552278a30db5f98de1e66da9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 14 Jul 2018 16:02:33 +0200 Subject: [PATCH] Don't create lz4buf on stack. --- server/TracyWorker.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index b2414272..21fe4bd3 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -968,6 +968,7 @@ void Worker::Exec() return m_shutdown.load( std::memory_order_relaxed ); }; + auto lz4buf = std::make_unique( LZ4Size ); for(;;) { if( m_shutdown.load( std::memory_order_relaxed ) ) return; @@ -1017,13 +1018,12 @@ void Worker::Exec() if( m_shutdown.load( std::memory_order_relaxed ) ) return; auto buf = m_buffer + m_bufferOffset; - char lz4buf[LZ4Size]; lz4sz_t lz4sz; if( !m_sock.Read( &lz4sz, sizeof( lz4sz ), &tv, ShouldExit ) ) goto close; - if( !m_sock.Read( lz4buf, lz4sz, &tv, ShouldExit ) ) goto close; + if( !m_sock.Read( lz4buf.get(), lz4sz, &tv, ShouldExit ) ) goto close; bytes += sizeof( lz4sz ) + lz4sz; - auto sz = LZ4_decompress_safe_continue( m_stream, lz4buf, buf, lz4sz, TargetFrameSize ); + auto sz = LZ4_decompress_safe_continue( m_stream, lz4buf.get(), buf, lz4sz, TargetFrameSize ); assert( sz >= 0 ); decBytes += sz;