From 6225e54256bb05586cecfaa2f69fd08e4b65abc9 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Tue, 28 Mar 2023 13:09:15 -0400 Subject: [PATCH] replace bare pointer for a proper smart pointer; --- src/network/rest/http/HTTPClient.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/network/rest/http/HTTPClient.h b/src/network/rest/http/HTTPClient.h index c58fa76d..19c21f52 100644 --- a/src/network/rest/http/HTTPClient.h +++ b/src/network/rest/http/HTTPClient.h @@ -133,8 +133,6 @@ namespace network if (m_connection != nullptr) { m_connection->stop(); - delete m_connection; - m_connection = nullptr; } wait(); @@ -155,8 +153,6 @@ namespace network if (m_connection != nullptr) { m_connection->stop(); - delete m_connection; - m_connection = nullptr; } } @@ -164,7 +160,7 @@ namespace network void connect(asio::ip::basic_resolver_results& endpoints) { asio::connect(m_socket, endpoints); - m_connection = new ConnectionType(std::move(m_socket), m_requestHandler); + m_connection = new_unique(ConnectionType, std::move(m_socket), m_requestHandler); m_connection->start(); } @@ -173,7 +169,7 @@ namespace network typedef ConnectionImpl ConnectionType; - ConnectionType* m_connection; + std::unique_ptr m_connection; bool m_completed = false; asio::io_context m_ioContext;