Fix NULL-pointer crash in handoff_init(...) 32/1532/1
authorDave Barach <dave@barachs.net>
Mon, 13 Jun 2016 22:16:27 +0000 (18:16 -0400)
committerDave Barach <dave@barachs.net>
Mon, 13 Jun 2016 22:17:23 +0000 (18:17 -0400)
Change-Id: If403f83b4e918e81e7b2e90dfca14960ad2c6aa6
Signed-off-by: Dave Barach <dave@barachs.net>
vnet/vnet/handoff.c

index 6cb8d02..af8068a 100644 (file)
@@ -513,11 +513,14 @@ clib_error_t *handoff_init (vlib_main_t *vm)
   vlib_thread_registration_t * tr;
   /* Only the standard vnet worker threads are supported */
   p = hash_get_mem (tm->thread_registrations_by_name, "workers");
-  tr = (vlib_thread_registration_t *) p[0];
-  if (tr)
+  if (p)
     {
-      hm->num_workers = tr->count;
-      hm->first_worker_index = tr->first_index;
+      tr = (vlib_thread_registration_t *) p[0];
+      if (tr)
+        {
+          hm->num_workers = tr->count;
+          hm->first_worker_index = tr->first_index;
+        }
     }
 
   hm->vlib_main = vm;