diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-26 11:09:34 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-26 11:09:34 +0900 |
commit | 979756e26af57e715efe64f8de8068243fa27e9f (patch) | |
tree | b343cfba18f1a69ccd934b7d060cdf2187ba70f3 /events | |
parent | 4bb5f23d1b70136769a8df76907acb75aa824af9 (diff) | |
download | libquotient-979756e26af57e715efe64f8de8068243fa27e9f.tar.gz libquotient-979756e26af57e715efe64f8de8068243fa27e9f.zip |
Deal with memory more carefully
Plugs some memory leaks reported by Valgrind.
Diffstat (limited to 'events')
-rw-r--r-- | events/event.cpp | 3 | ||||
-rw-r--r-- | events/event.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/events/event.cpp b/events/event.cpp index b55c44c4..74a2c3d7 100644 --- a/events/event.cpp +++ b/events/event.cpp @@ -120,7 +120,8 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& rep) auto redaction = unsignedData.value("redacted_because"); if (redaction.isObject()) { - _redactedBecause.reset(new RedactionEvent(redaction.toObject())); + _redactedBecause = + std::make_unique<RedactionEvent>(redaction.toObject()); return; } diff --git a/events/event.h b/events/event.h index 4bd08b55..f0ca2d15 100644 --- a/events/event.h +++ b/events/event.h @@ -100,7 +100,7 @@ namespace QMatrixClient { auto e = _impl::doMakeEvent<EventT>(obj); if (!e) - e.reset(new EventT(EventType::Unknown, obj)); + e = std::make_unique<EventT>(EventType::Unknown, obj); return e; } |