From 3f163cbd269ed870ca1bfef0af71ed18c56950fd Mon Sep 17 00:00:00 2001 From: "Klein, Thorsten (BSH)" Date: Tue, 24 Mar 2020 10:55:19 +0100 Subject: [PATCH] fix memory leaks in DBusInputStream --- include/CommonAPI/DBus/DBusInputStream.hpp | 3 ++- src/CommonAPI/DBus/DBusInputStream.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp index 568dc4d..09b39bb 100644 --- a/include/CommonAPI/DBus/DBusInputStream.hpp +++ b/include/CommonAPI/DBus/DBusInputStream.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -518,7 +519,7 @@ class DBusInputStream char *begin_; size_t current_; size_t size_; - CommonAPI::DBus::DBusError* exception_; + std::unique_ptr exception_; CommonAPI::DBus::DBusMessage message_; std::vector sizes_; diff --git a/src/CommonAPI/DBus/DBusInputStream.cpp b/src/CommonAPI/DBus/DBusInputStream.cpp index 1bede6f..5a9ca20 100644 --- a/src/CommonAPI/DBus/DBusInputStream.cpp +++ b/src/CommonAPI/DBus/DBusInputStream.cpp @@ -49,7 +49,7 @@ char *DBusInputStream::_readRaw(const size_t _size) { } void DBusInputStream::setError() { - exception_ = new CommonAPI::DBus::DBusError(); + exception_ = std::unique_ptr(new CommonAPI::DBus::DBusError()); } void DBusInputStream::pushPosition() {