struct intr_controller * tmp;
// clear out any controllers that were left around
- list_for_each_entry_safe(ctrlr, tmp, &(intr_state->controller_list), ctrl_node) {
- v3_remove_intr_controller(core, ctrlr);
- }
+ if (*(void**)&intr_state->controller_list) {
+ list_for_each_entry_safe(ctrlr, tmp, &(intr_state->controller_list), ctrl_node) {
+ v3_remove_intr_controller(core, ctrlr);
+ }
- v3_lock_deinit(&(intr_state->irq_lock));
+ v3_lock_deinit(&(intr_state->irq_lock));
+ }
}
struct intr_router * rtr = NULL;
struct intr_router * tmp = NULL;
- // clear out any controllers that were left around
- list_for_each_entry_safe(rtr, tmp, &(vm->intr_routers.router_list), router_node) {
- v3_remove_intr_router(vm, rtr);
- }
+ // clear out any routers that were left around
+ if (*(void**)&vm->intr_routers.router_list) {
+ list_for_each_entry_safe(rtr, tmp, &(vm->intr_routers.router_list), router_node) {
+ v3_remove_intr_router(vm, rtr);
+ }
- v3_lock_deinit(&(vm->intr_routers.irq_lock));
+ v3_lock_deinit(&(vm->intr_routers.irq_lock));
+ }
}
void * v3_register_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * priv_data) {
int v3_deinit_shdw_pg_state(struct guest_info * core) {
- struct v3_shdw_pg_impl * impl = core->vm_info->shdw_impl.current_impl;
+ struct v3_shdw_pg_impl * impl = NULL;
+
+ if (!core || !core->vm_info) {
+ return -1;
+ }
+
+ impl = core->vm_info->shdw_impl.current_impl;
- if (impl->local_deinit(core) == -1) {
+ if (impl && impl->local_deinit(core) == -1) {
PrintError(core->vm_info, core, "Error deinitializing shadow paging state\n");
return -1;
}
struct v3_timer * tmr = NULL;
struct v3_timer * tmp = NULL;
- list_for_each_entry_safe(tmr, tmp, &(time_state->timers), timer_link) {
- v3_remove_timer(core, tmr);
+ if (*(void**)&time_state->timers) {
+ list_for_each_entry_safe(tmr, tmp, &(time_state->timers), timer_link) {
+ v3_remove_timer(core, tmr);
+ }
}
}