diff --git a/src/network_engine.cpp b/src/network_engine.cpp index 5300d5a8..b25bd9c4 100644 --- a/src/network_engine.cpp +++ b/src/network_engine.cpp @@ -415,7 +415,7 @@ NetworkEngine::processMessage(const uint8_t *buf, size_t buflen, SockAddr f) return; } - std::unique_ptr msg {new ParsedMessage}; + auto msg = std::make_unique(); try { msgpack::unpacked msg_res = msgpack::unpack((const char*)buf, buflen); msg->msgpack_unpack(msg_res.get()); diff --git a/src/value.cpp b/src/value.cpp index f5ef263d..9529a472 100644 --- a/src/value.cpp +++ b/src/value.cpp @@ -296,8 +296,8 @@ Value::decrypt(const crypto::PrivateKey& key) decrypted = true; if (isEncrypted()) { auto decryptedBlob = key.decrypt(cypher); - std::unique_ptr v {new Value(id)}; auto msg = msgpack::unpack((const char*)decryptedBlob.data(), decryptedBlob.size()); + auto v = std::make_unique(id); v->msgpack_unpack_body(msg.get()); if (v->recipient != key.getPublicKey().getId()) throw crypto::DecryptError("Recipient mismatch");