Take boost error_code by reference

By convention, we should be following boost here, and passing error_code
by reference, not by value.  This makes our code consistent, and removes
the need for a copy in some cases.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Id42ea4a90b6685a84818b87d1506c11256b3b9ae
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 45f384b..00b4223 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -178,7 +178,7 @@
     BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
     crow::connections::systemBus->async_method_call(
         [name, aResp{std::move(aResp)}](
-            const boost::system::error_code ec,
+            const boost::system::error_code& ec,
             const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
@@ -218,7 +218,7 @@
 
     crow::connections::systemBus->async_method_call(
         [resName, name,
-         aResp](const boost::system::error_code ec,
+         aResp](const boost::system::error_code& ec,
                 const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
@@ -702,7 +702,7 @@
     }
 
     crow::connections::systemBus->async_method_call(
-        [asyncResp, secretPipe](const boost::system::error_code ec,
+        [asyncResp, secretPipe](const boost::system::error_code& ec,
                                 bool success) {
         if (ec)
         {
@@ -734,7 +734,7 @@
     if (legacy)
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
@@ -749,7 +749,7 @@
     else // proxy
     {
         crow::connections::systemBus->async_method_call(
-            [asyncResp](const boost::system::error_code ec) {
+            [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
                 BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
@@ -818,7 +818,7 @@
 
         crow::connections::systemBus->async_method_call(
             [service, resName, actionParams,
-             asyncResp](const boost::system::error_code ec2,
+             asyncResp](const boost::system::error_code& ec2,
                         dbus::utility::ManagedObjectType& subtree) mutable {
             if (ec2)
             {
@@ -915,7 +915,7 @@
 
         crow::connections::systemBus->async_method_call(
             [resName, service, asyncResp{asyncResp}](
-                const boost::system::error_code ec,
+                const boost::system::error_code& ec,
                 const dbus::utility::ManagedObjectType& subtree) {
             if (ec)
             {