summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2010-07-21 08:35:31 -0600
committerAurelien Jarno <aurelien@aurel32.net>2010-07-30 23:00:56 +0200
commit69e58af92cf90a1a0551c73880928afa6753fa5f (patch)
treefc08a8fd01accef7b15ff2365a9288637e44b20b
parent5ab4bb598d3f58542a06a6946f04b140be222892 (diff)
downloadhqemu-69e58af92cf90a1a0551c73880928afa6753fa5f.zip
hqemu-69e58af92cf90a1a0551c73880928afa6753fa5f.tar.gz
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>
-rw-r--r--savevm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/savevm.c b/savevm.c
index 7a1de3c..4c0e5d3 100644
--- a/savevm.c
+++ b/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) {
if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {
QTAILQ_REMOVE(&savevm_handlers, se, entry);
+ if (se->compat) {
+ qemu_free(se->compat);
+ }
qemu_free(se);
}
}
@@ -1206,6 +1209,9 @@ void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
QTAILQ_FOREACH_SAFE(se, &savevm_handlers, entry, new_se) {
if (se->vmsd == vmsd && se->opaque == opaque) {
QTAILQ_REMOVE(&savevm_handlers, se, entry);
+ if (se->compat) {
+ qemu_free(se->compat);
+ }
qemu_free(se);
}
}
OpenPOWER on IntegriCloud