From 1fc11ae762177553ee27b7ef5a3b81540b3913a5 Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Wed, 17 Apr 2024 21:32:21 +0800 Subject: [PATCH] nixd/Eval: avoid potential dangling reference in AttrSetProvider --- nixd/lib/Eval/AttrSetProvider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixd/lib/Eval/AttrSetProvider.cpp b/nixd/lib/Eval/AttrSetProvider.cpp index 1ed8472dc..24441f5f3 100644 --- a/nixd/lib/Eval/AttrSetProvider.cpp +++ b/nixd/lib/Eval/AttrSetProvider.cpp @@ -256,7 +256,7 @@ void AttrSetProvider::onOptionComplete( for (const auto *AttrPtr : Scope.attrs->lexicographicOrder(state().symbols)) { const nix::Attr &Attr = *AttrPtr; - const std::string &Name = state().symbols[Attr.name]; + std::string Name = state().symbols[Attr.name]; if (Name.starts_with(Params.Prefix)) { // Add a new "OptionField", see it's type. assert(Attr.value);