Use std::vector<string> to get D-Bus object list
Replace std::array<const char*, N> with std::vector<std::string> to
retrieve the D-Bus object list, fixing the free-noheap-object CI error.
Change-Id: Ie48d691aee1a9f595439ad59e844e2a0857a2085
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-manager/include/utility/dbus_utility.hpp b/vpd-manager/include/utility/dbus_utility.hpp
index c155d0c..41ff05c 100644
--- a/vpd-manager/include/utility/dbus_utility.hpp
+++ b/vpd-manager/include/utility/dbus_utility.hpp
@@ -26,12 +26,12 @@
* generate appropriate error.
*
* @param [in] objectPath - Object path under the service.
- * @param [in] interfaces - Array of interface(s).
+ * @param [in] interfaces - Vector of interface(s).
* @return - A Map of service name to object to interface(s), if success.
* If failed, empty map.
*/
-inline types::MapperGetObject getObjectMap(const std::string& objectPath,
- std::span<const char*> interfaces)
+inline types::MapperGetObject getObjectMap(
+ const std::string& objectPath, const std::vector<std::string>& interfaces)
{
types::MapperGetObject getObjectMap;
diff --git a/vpd-manager/include/utility/vpd_specific_utility.hpp b/vpd-manager/include/utility/vpd_specific_utility.hpp
index acbc627..73cee0e 100644
--- a/vpd-manager/include/utility/vpd_specific_utility.hpp
+++ b/vpd-manager/include/utility/vpd_specific_utility.hpp
@@ -394,7 +394,7 @@
}
else
{
- std::array<const char*, 1> interfaceList = {kwdInterface.c_str()};
+ std::vector<std::string> interfaceList = {kwdInterface};
types::MapperGetObject mapperRetValue = dbusUtility::getObjectMap(
std::string(constants::systemVpdInvPath), interfaceList);
@@ -622,7 +622,7 @@
{
try
{
- std::array<const char*, 0> l_interfaces;
+ std::vector<std::string> l_interfaces;
const types::MapperGetObject& l_getObjectMap =
dbusUtility::getObjectMap(i_objectPath, l_interfaces);
diff --git a/vpd-manager/src/worker.cpp b/vpd-manager/src/worker.cpp
index f81a9c1..e4033e1 100644
--- a/vpd-manager/src/worker.cpp
+++ b/vpd-manager/src/worker.cpp
@@ -107,7 +107,7 @@
INVENTORY_JSON_SYM_LINK);
}
- std::array<const char*, 1> interfaces = {
+ std::vector<std::string> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
const types::MapperGetObject& objectMap =
@@ -952,7 +952,7 @@
{
if (!dbusUtility::isChassisPowerOn())
{
- std::array<const char*, 1> l_operationalStatusInf = {
+ std::vector<std::string> l_operationalStatusInf = {
constants::operationalStatusInf};
auto mapperObjectMap = dbusUtility::getObjectMap(
@@ -991,7 +991,7 @@
{
if (!dbusUtility::isChassisPowerOn())
{
- std::array<const char*, 1> l_enableInf = {constants::enableInf};
+ std::vector<std::string> l_enableInf = {constants::enableInf};
auto mapperObjectMap =
dbusUtility::getObjectMap(i_inventoryObjPath, l_enableInf);