Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory leaks in DBusInputStream #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/CommonAPI/DBus/DBusInputStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <string>
#include <vector>
#include <cstring>
#include <memory>

#include <CommonAPI/Export.hpp>
#include <CommonAPI/InputStream.hpp>
Expand Down Expand Up @@ -518,7 +519,7 @@ class DBusInputStream
char *begin_;
size_t current_;
size_t size_;
CommonAPI::DBus::DBusError* exception_;
std::unique_ptr<CommonAPI::DBus::DBusError> exception_;
CommonAPI::DBus::DBusMessage message_;

std::vector<uint32_t> sizes_;
Expand Down
2 changes: 1 addition & 1 deletion src/CommonAPI/DBus/DBusInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ char *DBusInputStream::_readRaw(const size_t _size) {
}

void DBusInputStream::setError() {
exception_ = new CommonAPI::DBus::DBusError();
exception_ = std::unique_ptr<CommonAPI::DBus::DBusError>(new CommonAPI::DBus::DBusError());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= std::make_unique<CommonAPI::DBus::DBusError>();

}

void DBusInputStream::pushPosition() {
Expand Down