mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
savevm: Fix memory leak of compat struct
Forgot to check for and free these. Found-by: Zachary Amsden <zamsden@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
5ab4bb598d
commit
69e58af92c
6
savevm.c
6
savevm.c
@ -1139,6 +1139,9 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
|
|||||||
QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {
|
QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {
|
||||||
if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {
|
if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {
|
||||||
QTAILQ_REMOVE(&savevm_handlers, se, entry);
|
QTAILQ_REMOVE(&savevm_handlers, se, entry);
|
||||||
|
if (se->compat) {
|
||||||
|
qemu_free(se->compat);
|
||||||
|
}
|
||||||
qemu_free(se);
|
qemu_free(se);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1206,6 +1209,9 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
|
|||||||
QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {
|
QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {
|
||||||
if (se->vmsd == vmsd && se->opaque == opaque) {
|
if (se->vmsd == vmsd && se->opaque == opaque) {
|
||||||
QTAILQ_REMOVE(&savevm_handlers, se, entry);
|
QTAILQ_REMOVE(&savevm_handlers, se, entry);
|
||||||
|
if (se->compat) {
|
||||||
|
qemu_free(se->compat);
|
||||||
|
}
|
||||||
qemu_free(se);
|
qemu_free(se);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user