Sure Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> On Mon, 2018-07-02 at 08:43 +0100, Frediano Ziglio wrote: > Make automatic the release of this pointer. > Also avoids having a leak if VDAgent::run is called twice. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > vdagent/vdagent.cpp | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp > index 73fd2e3..0672516 100644 > --- a/vdagent/vdagent.cpp > +++ b/vdagent/vdagent.cpp > @@ -141,7 +141,7 @@ private: > bool _running; > bool _session_is_locked; > bool _desktop_switch; > - DesktopLayout* _desktop_layout; > + std::unique_ptr<DesktopLayout> _desktop_layout; > bool _updating_display_config; > DisplaySetting _display_setting; > FileXfer _file_xfer; > @@ -196,7 +196,6 @@ VDAgent::VDAgent() > , _running (false) > , _session_is_locked (false) > , _desktop_switch (false) > - , _desktop_layout (NULL) > , _display_setting (VD_AGENT_REGISTRY_KEY) > , _vio_serial (INVALID_HANDLE_VALUE) > , _read_pos (0) > @@ -299,7 +298,7 @@ bool VDAgent::run() > cleanup(); > return false; > } > - _desktop_layout = new DesktopLayout(); > + _desktop_layout.reset(new DesktopLayout()); > if (_desktop_layout->get_display_count() == 0) { > vd_printf("No QXL devices!"); > } > @@ -340,7 +339,6 @@ void VDAgent::cleanup() > CloseHandle(_stop_event); > CloseHandle(_control_event); > CloseHandle(_vio_serial); > - delete _desktop_layout; > } > > void VDAgent::set_control_event(control_command_t control_command) _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel