Skip to content

Commit 3f163cb

Browse files
fix memory leaks in DBusInputStream
1 parent 9f85f0f commit 3f163cb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/CommonAPI/DBus/DBusInputStream.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <string>
2020
#include <vector>
2121
#include <cstring>
22+
#include <memory>
2223

2324
#include <CommonAPI/Export.hpp>
2425
#include <CommonAPI/InputStream.hpp>
@@ -518,7 +519,7 @@ class DBusInputStream
518519
char *begin_;
519520
size_t current_;
520521
size_t size_;
521-
CommonAPI::DBus::DBusError* exception_;
522+
std::unique_ptr<CommonAPI::DBus::DBusError> exception_;
522523
CommonAPI::DBus::DBusMessage message_;
523524

524525
std::vector<uint32_t> sizes_;

src/CommonAPI/DBus/DBusInputStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ char *DBusInputStream::_readRaw(const size_t _size) {
4949
}
5050

5151
void DBusInputStream::setError() {
52-
exception_ = new CommonAPI::DBus::DBusError();
52+
exception_ = std::unique_ptr<CommonAPI::DBus::DBusError>(new CommonAPI::DBus::DBusError());
5353
}
5454

5555
void DBusInputStream::pushPosition() {

0 commit comments

Comments
 (0)