controller: Work around clang-tidy issue with boost
See https://bugs.llvm.org/show_bug.cgi?id=41141
```
../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:137:25: error: Potential memory leak [clang-analyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0)
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:100:9: note: Assuming the condition is false
if (options["path"].empty())
^~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:100:5: note: Taking false branch
if (options["path"].empty())
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:135:5: note: Calling 'getLedDescr'
getLedDescr(name, ledDescr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:56:5: note: Calling 'split<std::vector<std::basic_string<char>>, const std::basic_string<char> &, boost::algorithm::detail::is_any_ofF<char>>'
boost::split(words, name, boost::is_any_of(":"));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/split.hpp:161:17: note: Calling 'token_finder<boost::algorithm::detail::is_any_ofF<char>>'
::boost::algorithm::token_finder( Pred, eCompress ) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/finder.hpp:219:20: note: Calling constructor for 'token_finderF<boost::algorithm::detail::is_any_ofF<char>>'
return detail::token_finderF<PredicateT>( Pred, eCompress );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/finder.hpp:554:25: note: Calling copy constructor for 'is_any_ofF<char>'
m_Pred(Pred), m_eCompress(eCompress) {}
^~~~~~~~~~~~
../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:116:21: note: Taking false branch
if(use_fixed_storage(m_Size))
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:125:44: note: Memory is allocated
m_Storage.m_dynSet=new set_value_type[m_Size];
^~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/finder.hpp:554:25: note: Returning from copy constructor for 'is_any_ofF<char>'
m_Pred(Pred), m_eCompress(eCompress) {}
^~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/finder.hpp:219:20: note: Returning from constructor for 'token_finderF<boost::algorithm::detail::is_any_ofF<char>>'
return detail::token_finderF<PredicateT>( Pred, eCompress );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/split.hpp:161:17: note: Returned allocated memory
::boost::algorithm::token_finder( Pred, eCompress ) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/split.hpp:161:51: note: Calling '~is_any_ofF'
::boost::algorithm::token_finder( Pred, eCompress ) );
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:137:25: note: Potential memory leak
if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0)
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:141:17: error: Potential memory leak [clang-an
alyzer-cplusplus.NewDeleteLeaks,-warnings-as-errors]
}
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:100:9: note: Assuming the condition is false
if (options["path"].empty())
^~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:100:5: note: Taking false branch
if (options["path"].empty())
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:135:5: note: Calling 'getLedDescr'
getLedDescr(name, ledDescr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../controller.cpp:56:5: note: Calling 'split<std::vector<std::basic_string<char>>, const std::basic_string<char> &, boost::algorithm::detail::is_any_ofF<char>>'
boost::split(words, name, boost::is_any_of(":"));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/split.hpp:161:17: note: Calling 'token_finder<boost::algorithm::detail::is_any_ofF<char>>'
::boost::algorithm::token_finder( Pred, eCompress ) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/finder.hpp:219:55: note: Calling copy constructor for 'is_any_ofF<char>'
return detail::token_finderF<PredicateT>( Pred, eCompress );
^~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:116:21: note: Taking false branch
if(use_fixed_storage(m_Size))
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:125:44: note: Memory is allocated
m_Storage.m_dynSet=new set_value_type[m_Size];
^~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/finder.hpp:219:55: note: Returning from copy constructor for 'is_any_ofF<char>'
return detail::token_finderF<PredicateT>( Pred, eCompress );
^~~~
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/finder.hpp:219:55: note: Calling '~is_any_ofF'
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:137:51: note: Left side of '&&' is false
if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0)
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../subprojects/boost_1_81_0/boost/algorithm/string/detail/classification.hpp:141:17: note: Potential memory leak
}
^
138378 warnings generated.
```
Change-Id: Ie7e36805f91971f6057ea1e6e143fcf4dffcac65
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/controller.cpp b/controller.cpp
index 517c6ab..afe476e 100644
--- a/controller.cpp
+++ b/controller.cpp
@@ -93,6 +93,9 @@
// Read arguments.
auto options = phosphor::led::ArgumentParser(argc, argv);
+ // FIXME: https://bugs.llvm.org/show_bug.cgi?id=41141
+ // NOLINTBEGIN(clang-analyzer-cplusplus.NewDeleteLeaks)
+
// Parse out Path argument.
if (options["path"].empty())
{
@@ -130,6 +133,7 @@
// Convert LED name in sysfs into DBus name
LedDescr ledDescr;
getLedDescr(name, ledDescr);
+ // NOLINTEND(clang-analyzer-cplusplus.NewDeleteLeaks)
name = getDbusName(ledDescr);
// Unique bus name representing a single LED.