nixos-option: fix potential memory leak in mapOptions
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
Checks:
|
||||
- -*
|
||||
- bugprone-*
|
||||
# don't find them too problematic
|
||||
- -bugprone-easily-swappable-parameters
|
||||
|
||||
@@ -313,7 +313,7 @@ void mapOptions(const std::function<void(const std::string & path)> & f, Context
|
||||
{
|
||||
auto root = findAlongOptionPath(ctx, path);
|
||||
recurse(
|
||||
[f, &ctx](const std::string & path, std::variant<Value, std::exception_ptr> v) {
|
||||
[&f, &ctx](const std::string & path, std::variant<Value, std::exception_ptr> v) {
|
||||
const bool isOpt = std::holds_alternative<std::exception_ptr>(v) || isOption(ctx, std::get<Value>(v));
|
||||
if (isOpt) {
|
||||
f(path);
|
||||
|
||||
Reference in New Issue
Block a user