about summary refs log tree commit diff
path: root/src/libexpr/attr-set.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/attr-set.cc')
-rw-r--r--src/libexpr/attr-set.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libexpr/attr-set.cc b/src/libexpr/attr-set.cc
index 910428c02686..b284daa3c2f7 100644
--- a/src/libexpr/attr-set.cc
+++ b/src/libexpr/attr-set.cc
@@ -7,13 +7,14 @@
 namespace nix {
 
 
+/* Note: Various places expect the allocated memory to be zeroed. */
 static void * allocBytes(size_t n)
 {
     void * p;
 #if HAVE_BOEHMGC
     p = GC_malloc(n);
 #else
-    p = malloc(n);
+    p = calloc(n, 1);
 #endif
     if (!p) throw std::bad_alloc();
     return p;