aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-01-17 15:07:22 +0100
committerMichael Tokarev <mjt@tls.msk.ru>2024-01-29 23:00:39 +0300
commite589e5ade7e7dc1f14eacc1670646439e4c07284 (patch)
tree47245bc6d6b4de35e574faf43807a1cbbd11c94e
parentf48c205fb42be48e2e47b7e1cd9a2802e5ca17b0 (diff)
downloadqemu-e589e5ade7e7dc1f14eacc1670646439e4c07284.zip
qemu-e589e5ade7e7dc1f14eacc1670646439e4c07284.tar.gz
qemu-e589e5ade7e7dc1f14eacc1670646439e4c07284.tar.bz2
migration: Plug memory leak on HMP migrate error path
hmp_migrate() leaks @caps when qmp_migrate() fails. Plug the leak with g_autoptr(). Fixes: 967f2de5c9ec (migration: Implement MigrateChannelList to hmp migration flow.) v8.2.0-rc0 Fixes: CID 1533125 Signed-off-by: Markus Armbruster <armbru@redhat.com> Link: https://lore.kernel.org/r/20240117140722.3979657-1-armbru@redhat.com [peterx: fix CID number as reported by Peter Maydell] Signed-off-by: Peter Xu <peterx@redhat.com> (cherry picked from commit 918f620d30a9b0095b7824b8d77a2d6059a439d9) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--migration/migration-hmp-cmds.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 86ae832..2faa5ca 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -762,7 +762,7 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
bool resume = qdict_get_try_bool(qdict, "resume", false);
const char *uri = qdict_get_str(qdict, "uri");
Error *err = NULL;
- MigrationChannelList *caps = NULL;
+ g_autoptr(MigrationChannelList) caps = NULL;
g_autoptr(MigrationChannel) channel = NULL;
if (inc) {
@@ -787,8 +787,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
return;
}
- qapi_free_MigrationChannelList(caps);
-
if (!detach) {
HMPMigrationStatus *status;