X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_events.c;h=7402959b7c36db5df5ae4de66def77b94abf0d1f;hb=a5d2c00cc461b4a60a1360a2a0bba55cef467bab;hp=535db0932aacccce26a331babe85db2d76de5e3e;hpb=acaadd79c597c8d5180fbfbec79c01fef3dff003;p=palacios.git diff --git a/palacios/src/palacios/vmm_events.c b/palacios/src/palacios/vmm_events.c index 535db09..7402959 100644 --- a/palacios/src/palacios/vmm_events.c +++ b/palacios/src/palacios/vmm_events.c @@ -28,13 +28,14 @@ int v3_init_events(struct v3_vm_info * vm) { struct v3_event_map * map = &(vm->event_map); int i = 0; - map->events = V3_Malloc(sizeof(struct list_head) * V3_EVENT_INVALID); + map->events = V3_Malloc(sizeof(struct list_head) * (V3_EVENT_INVALID+1)); if (map->events == NULL) { PrintError(vm, VCORE_NONE, "Error: could not allocate event map\n"); return -1; } + // dead code if there are no events, but this is correct for (i = 0; i < V3_EVENT_INVALID; i++) { INIT_LIST_HEAD(&(map->events[i])); } @@ -46,6 +47,8 @@ int v3_deinit_events(struct v3_vm_info * vm) { struct v3_event_map * map = &(vm->event_map); int i = 0; + + // dead code if there are no events, but this is correct for (i = 0; i < V3_EVENT_INVALID; i++) { if (!list_empty(&(map->events[i]))) { struct v3_notifier * tmp_notifier = NULL;