about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr/eval.cc')
-rw-r--r--third_party/nix/src/libexpr/eval.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index 28ae46bdfd8c..2a0aba1a4c8b 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -598,15 +598,15 @@ Env& EvalState::allocEnv(size_t size) {
   return *env;
 }
 
-void EvalState::mkList(Value& v, NixList* list) {
+void EvalState::mkList(Value& v, std::shared_ptr<NixList> list) {
+  nrListElems += list->size();
   clearValue(v);
   v.type = tList;
   v.list = list;
-  nrListElems += list->size();
 }
 
 void EvalState::mkList(Value& v, size_t size) {
-  EvalState::mkList(v, new NixList(size));
+  EvalState::mkList(v, std::make_shared<NixList>(size));
 }
 
 unsigned long nrThunks = 0;
@@ -1224,7 +1224,7 @@ void ExprOpConcatLists::eval(EvalState& state, Env& env, Value& v) {
 void EvalState::concatLists(Value& v, const NixList& lists, const Pos& pos) {
   nrListConcats++;
 
-  auto outlist = new NixList();
+  auto outlist = std::make_shared<NixList>();
 
   for (Value* list : lists) {
     forceList(*list, pos);
@@ -1816,8 +1816,8 @@ size_t valueSize(const Value& v) {
         }
         break;
       case tList:
-        if (seenLists.find(v.list) == seenLists.end()) {
-          seenLists.insert(v.list);
+        if (seenLists.find(v.list.get()) == seenLists.end()) {
+          seenLists.insert(v.list.get());
           sz += v.listSize() * sizeof(Value*);
           for (const Value* v : *v.list) {
             sz += doValue(*v);