From 1109ea068097d4c5e3a4dfdeececf4590c52329a Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Wed, 21 Jan 2004 14:49:32 +0000
Subject: [PATCH] * Fixed a subtle uninitialised variable bug in ATermMaps
 copied from   ATermMaps.  Found thanks to Valgrind!

---
 src/libexpr/nixexpr.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index dd0f5d58a..7de3e823c 100644
--- a/src/libexpr/nixexpr.cc
+++ b/src/libexpr/nixexpr.cc
@@ -4,6 +4,7 @@
 
 ATermMap::ATermMap(unsigned int initialSize, unsigned int maxLoadPct)
 {
+    this->maxLoadPct = maxLoadPct;
     table = ATtableCreate(initialSize, maxLoadPct);
     if (!table) throw Error("cannot create ATerm table");
 }
@@ -15,7 +16,8 @@ ATermMap::ATermMap(const ATermMap & map)
     ATermList keys = map.keys();
 
     /* !!! adjust allocation for load pct */
-    table = ATtableCreate(ATgetLength(keys), map.maxLoadPct);
+    maxLoadPct = map.maxLoadPct;
+    table = ATtableCreate(ATgetLength(keys), maxLoadPct);
     if (!table) throw Error("cannot create ATerm table");
 
     for (ATermIterator i(keys); i; ++i)
-- 
GitLab