summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-06-13 18:16:27 -0400
committerDave Barach <dave@barachs.net>2016-06-13 18:17:23 -0400
commit5a9c9b8bb50208dac6083dea3313a55caa3c1adf (patch)
treefd040a25cff51cbece111c1ef9ef73c441b49952
parent0247b4600235bc18e558a7c4267b59be897d714d (diff)
Fix NULL-pointer crash in handoff_init(...)
Change-Id: If403f83b4e918e81e7b2e90dfca14960ad2c6aa6 Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--vnet/vnet/handoff.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/vnet/vnet/handoff.c b/vnet/vnet/handoff.c
index 6cb8d02b431..af8068a8729 100644
--- a/vnet/vnet/handoff.c
+++ b/vnet/vnet/handoff.c
@@ -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;