diff --git a/src/variable.cpp b/src/variable.cpp
index f83d3ebc20a107f9f26a4ae8260c255a8cf56c96..9c837719f27c96c61e56e02040c15346b3c603c3 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -971,6 +971,7 @@ void Variable::compute_atom(int ivar, int igroup,
   } else vstore = reader[ivar]->fixstore->vstore;
 
   if (result == NULL) {
+    if (style[ivar] == ATOM) free_tree(tree);
     eval_in_progress[ivar] = 0;
     return;
   }
diff --git a/src/variable.h b/src/variable.h
index b20eb7e6b93e566f77d5421e820e59eb1a9b79b1..9a6aa4c0b401596cb16c1ea12cf930fabbd92de8 100644
--- a/src/variable.h
+++ b/src/variable.h
@@ -92,6 +92,13 @@ class Variable : protected Pointers {
     int nextra;            // # of additional args beyond first 2
     Tree *first,*second;   // ptrs further down tree for first 2 args
     Tree **extra;          // ptrs further down tree for nextra args
+
+    Tree() :
+      array(NULL), iarray(NULL), barray(NULL),
+      selfalloc(0), nextra(0),
+      first(NULL), second(NULL), extra(NULL)
+    {
+    }
   };
 
   int compute_python(int);