stats: crash when adding/deleting interfaces
[vpp.git] / src / vlib / error.c
index 7f69140..7d502d7 100644 (file)
@@ -131,11 +131,12 @@ vlib_register_errors (vlib_main_t * vm,
   if (n->n_errors > 0)
     heap_dealloc (em->counters_heap, n->error_heap_handle);
 
+  n->n_errors = n_errors;
+  n->error_counters = counters;
+
   if (n_errors == 0)
     return;
 
-  n->n_errors = n_errors;
-
   /*  Legacy node */
   if (!counters)
     {
@@ -149,8 +150,6 @@ vlib_register_errors (vlib_main_t * vm,
        }
     }
 
-  n->error_counters = counters;
-
   n->error_heap_index =
     heap_alloc (em->counters_heap, n_errors, n->error_heap_handle);
   l = vec_len (em->counters_heap);