handler: fix undefined behavior
Saving a reference to a temporary returned from a function call is
undefined behavior and subverts RVO. Remove the `&` so these become
local variables.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I8e7da30fddef808dfe7ee323d7f91a7c2a2cdeb6
diff --git a/src/handler.cpp b/src/handler.cpp
index 30b7ba3..5983ad9 100644
--- a/src/handler.cpp
+++ b/src/handler.cpp
@@ -293,7 +293,7 @@
std::get<endpointsPos>(findEndpoint->second);
std::unordered_set<std::string> associationSet(association.begin(),
association.end());
- const std::vector<InterfaceMapType::value_type>& interfacePairs =
+ const std::vector<InterfaceMapType::value_type> interfacePairs =
getSubTree(interfaceMap, reqPath, depth, interfaces);
std::vector<InterfaceMapType::value_type> output;
@@ -323,7 +323,7 @@
std::get<endpointsPos>(findEndpoint->second);
std::unordered_set<std::string> associationSet(association.begin(),
association.end());
- const std::vector<std::string>& paths =
+ const std::vector<std::string> paths =
getSubTreePaths(interfaceMap, reqPath, depth, interfaces);
std::vector<std::string> output;