mgmt: fix Dispatcher::processControlCommandInterest memory error
refs #4059
Change-Id: I6655662f925bc5f40a2a2ec2b258a4accc29d58b
diff --git a/src/mgmt/dispatcher.cpp b/src/mgmt/dispatcher.cpp
index b9d62a2..62f9114 100644
--- a/src/mgmt/dispatcher.cpp
+++ b/src/mgmt/dispatcher.cpp
@@ -218,7 +218,7 @@
return;
}
- AcceptContinuation accept = bind(accepted, _1, prefix, interest, parameters.get());
+ AcceptContinuation accept = bind(accepted, _1, prefix, interest, parameters);
RejectContinuation reject = bind(rejected, _1, interest);
authorization(prefix, interest, parameters.get(), accept, reject);
}
@@ -227,7 +227,7 @@
Dispatcher::processAuthorizedControlCommandInterest(const std::string& requester,
const Name& prefix,
const Interest& interest,
- const ControlParameters* parameters,
+ const shared_ptr<ControlParameters>& parameters,
const ValidateParameters& validateParams,
const ControlCommandHandler& handler)
{
diff --git a/src/mgmt/dispatcher.hpp b/src/mgmt/dispatcher.hpp
index 7df61f7..a8b30b4 100644
--- a/src/mgmt/dispatcher.hpp
+++ b/src/mgmt/dispatcher.hpp
@@ -291,7 +291,7 @@
typedef std::function<void(const std::string& requester,
const Name& prefix,
const Interest& interest,
- const ControlParameters*)> AuthorizationAcceptedCallback;
+ const shared_ptr<ControlParameters>&)> AuthorizationAcceptedCallback;
typedef std::function<void(RejectReply act,
const Interest& interest)> AuthorizationRejectedCallback;
@@ -399,7 +399,7 @@
processAuthorizedControlCommandInterest(const std::string& requester,
const Name& prefix,
const Interest& interest,
- const ControlParameters* parameters,
+ const shared_ptr<ControlParameters>& parameters,
const ValidateParameters& validate,
const ControlCommandHandler& handler);
@@ -484,11 +484,11 @@
const ControlCommandHandler& handler)
{
if (!m_topLevelPrefixes.empty()) {
- throw std::domain_error("one or more top-level prefix has been added");
+ BOOST_THROW_EXCEPTION(std::domain_error("one or more top-level prefix has been added"));
}
if (isOverlappedWithOthers(relPrefix)) {
- throw std::out_of_range("relPrefix overlaps with another relPrefix");
+ BOOST_THROW_EXCEPTION(std::out_of_range("relPrefix overlaps with another relPrefix"));
}
ControlParametersParser parser =