Skip to content

Commit

Permalink
Fix use after free.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mysticial committed Feb 6, 2025
1 parent d926747 commit 53af63e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ std::unique_ptr<ControllerConnection> SwitchController_SerialPABotBase_Descripto



SwitchController_SerialPABotBase::~SwitchController_SerialPABotBase(){
m_handle.disconnect();
}
SwitchController_SerialPABotBase::SwitchController_SerialPABotBase(
Logger& logger,
const SwitchController_SerialPABotBase_Descriptor& descriptor,
Expand Down Expand Up @@ -124,9 +127,9 @@ SwitchController_SerialPABotBase::SwitchController_SerialPABotBase(
}
)
, m_logger(logger, GlobalSettings::instance().LOG_EVERYTHING)
, m_logging_suppress(0)
, m_handle(m_logger, &descriptor.port(), requirements)
, m_serial(*m_handle.botbase())
, m_logging_suppress(0)
{
m_handle.connect(
&m_handle, &BotBaseHandle::on_not_connected,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class SwitchController_SerialPABotBase :
using ContextType = SwitchControllerContext;

public:
~SwitchController_SerialPABotBase();
SwitchController_SerialPABotBase(
Logger& logger,
const SwitchController_SerialPABotBase_Descriptor& descriptor,
Expand Down Expand Up @@ -203,15 +204,16 @@ class SwitchController_SerialPABotBase :

private:
SerialLogger m_logger;
BotBaseHandle m_handle;

std::string m_status;
std::string m_uptime;

BotBaseController& m_serial;

std::atomic<size_t> m_logging_suppress;
SpinLock m_lock;

BotBaseHandle m_handle;
BotBaseController& m_serial;
};


Expand Down

0 comments on commit 53af63e

Please sign in to comment.