[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.2 01/60] migration: Plug memory leak on HMP migrate error pa
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.2 01/60] migration: Plug memory leak on HMP migrate error path |
Date: |
Wed, 21 Feb 2024 11:19:49 +0300 |
From: Markus Armbruster <armbru@redhat.com>
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>
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 86ae832176..2faa5cad46 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;
--
2.39.2
- [Stable-8.2.2 v0 00/60] Patch Round-up for stable 8.2.2, freeze on 2024-03-02, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 01/60] migration: Plug memory leak on HMP migrate error path,
Michael Tokarev <=
- [Stable-8.2.2 02/60] migration: Fix use-after-free of migration state object, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 03/60] vfio/pci: Clear MSI-X IRQ index always, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 04/60] Make 'uri' optional for migrate QAPI, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 05/60] qemu-docs: Update options for graphical frontends, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 07/60] target/arm: fix exception syndrome for AArch32 bkpt insn, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 06/60] block/blkio: Make s->mem_region_alignment be 64 bits, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 09/60] qemu-options.hx: Improve -serial option documentation, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 08/60] system/vl.c: Fix handling of '-serial none -serial something', Michael Tokarev, 2024/02/21
- [Stable-8.2.2 11/60] pci-host: designware: Limit value range of iATU viewport register, Michael Tokarev, 2024/02/21
- [Stable-8.2.2 10/60] target/arm: Reinstate "vfp" property on AArch32 CPUs, Michael Tokarev, 2024/02/21