about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-01-21T14·49+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-01-21T14·49+0000
commit1109ea068097d4c5e3a4dfdeececf4590c52329a (patch)
tree58f8e98b4a69dc97b206790c29c56ef59f9fcb24 /src/libexpr/nixexpr.cc
parent47f19b6293357a8bdc3a2290813765170f241b58 (diff)
* Fixed a subtle uninitialised variable bug in ATermMaps copied from
  ATermMaps.  Found thanks to Valgrind!

Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r--src/libexpr/nixexpr.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc
index dd0f5d58af27..7de3e823c4f4 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)