From 518b10d464deefeaaa580a66ebef898c7089b4dc Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:55:50 +0100 Subject: [PATCH] DPL: fix small leak when receiving WS messages from the driver (#13871) --- Framework/Core/src/DPLWebSocket.cxx | 9 +++++---- Framework/Core/src/runDataProcessing.cxx | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Framework/Core/src/DPLWebSocket.cxx b/Framework/Core/src/DPLWebSocket.cxx index 77018f8cb44b4..a39e98c6f5310 100644 --- a/Framework/Core/src/DPLWebSocket.cxx +++ b/Framework/Core/src/DPLWebSocket.cxx @@ -167,10 +167,10 @@ struct GUIWebSocketHandler : public WebSocketHandler { } } } - void endFragmentation() override{}; - void control(char const* frame, size_t s) override{}; - void beginChunk() override{}; - void endChunk() override{}; + void endFragmentation() override {}; + void control(char const* frame, size_t s) override {}; + void beginChunk() override {}; + void endChunk() override {}; /// The driver context were we want to accumulate changes /// which we got from the websocket. @@ -415,6 +415,7 @@ void websocket_client_callback(uv_stream_t* stream, ssize_t nread, const uv_buf_ try { LOG(debug) << "Data received from server"; parse_http_request(buf->base, nread, context->client); + free(buf->base); } catch (RuntimeErrorRef& ref) { auto& err = o2::framework::error_from_ref(ref); LOG(error) << "Error while parsing request: " << err.what; diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index c8f77ab7082e6..f4fe042592e0a 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -491,6 +491,7 @@ void websocket_callback(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) } catch (WSError& e) { LOG(error) << "Error while parsing request: " << e.message; handler->error(e.code, e.message.c_str()); + free(buf->base); } }