diff --git a/hw/hw.h b/hw/hw.h index a0cb94e79bf758f8211778a53efa31648bd6679f..c70397503507c86df385cbafc7a79351357c8f17 100644 --- a/hw/hw.h +++ b/hw/hw.h @@ -509,5 +509,5 @@ extern void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, const void *opaque); extern int vmstate_register(int instance_id, const VMStateDescription *vmsd, void *base); -extern void vmstate_unregister(const char *idstr, void *opaque); +void vmstate_unregister(const VMStateDescription *vmsd, void *opaque); #endif diff --git a/savevm.c b/savevm.c index 0dcab79398d045d22dda30b034dc9b7d0c8f56d7..7b0989ff3799b2a7f7807d4afa8da9e13434e34a 100644 --- a/savevm.c +++ b/savevm.c @@ -1002,9 +1002,16 @@ int vmstate_register(int instance_id, const VMStateDescription *vmsd, return 0; } -void vmstate_unregister(const char *idstr, void *opaque) +void vmstate_unregister(const VMStateDescription *vmsd, void *opaque) { - unregister_savevm(idstr, opaque); + SaveStateEntry *se, *new_se; + + TAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) { + if (se->vmsd == vmsd && se->opaque == opaque) { + TAILQ_REMOVE(&savevm_handlers, se, entry); + qemu_free(se); + } + } } int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,