* [PATCH] migration: Plug memory leak on HMP migrate error path
@ 2024-01-17 14:07 Markus Armbruster
2024-01-18 6:58 ` Peter Xu
2024-01-23 16:33 ` Peter Maydell
0 siblings, 2 replies; 5+ messages in thread
From: Markus Armbruster @ 2024-01-17 14:07 UTC (permalink / raw)
To: qemu-devel; +Cc: peterx, farosas, het.gala
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 1533124
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
migration/migration-hmp-cmds.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index 740a219aa4..99b49df5dd 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -764,7 +764,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) {
@@ -789,8 +789,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
return;
}
- qapi_free_MigrationChannelList(caps);
-
if (!detach) {
HMPMigrationStatus *status;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Plug memory leak on HMP migrate error path
2024-01-17 14:07 [PATCH] migration: Plug memory leak on HMP migrate error path Markus Armbruster
@ 2024-01-18 6:58 ` Peter Xu
2024-01-23 16:33 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Peter Xu @ 2024-01-18 6:58 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, farosas, het.gala
On Wed, Jan 17, 2024 at 03:07:22PM +0100, Markus Armbruster wrote:
> 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 1533124
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
queued, thanks!
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Plug memory leak on HMP migrate error path
2024-01-17 14:07 [PATCH] migration: Plug memory leak on HMP migrate error path Markus Armbruster
2024-01-18 6:58 ` Peter Xu
@ 2024-01-23 16:33 ` Peter Maydell
2024-01-24 1:36 ` Peter Xu
1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2024-01-23 16:33 UTC (permalink / raw)
To: Markus Armbruster; +Cc: qemu-devel, peterx, farosas, het.gala
On Wed, 17 Jan 2024 at 19:49, Markus Armbruster <armbru@redhat.com> wrote:
>
> 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 1533124
Isn't this 1533125 ? 1533124 is a false positive in
the migrate_mode() function.
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> migration/migration-hmp-cmds.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
> index 740a219aa4..99b49df5dd 100644
> --- a/migration/migration-hmp-cmds.c
> +++ b/migration/migration-hmp-cmds.c
> @@ -764,7 +764,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) {
> @@ -789,8 +789,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)
> return;
> }
>
> - qapi_free_MigrationChannelList(caps);
> -
> if (!detach) {
> HMPMigrationStatus *status;
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Plug memory leak on HMP migrate error path
2024-01-23 16:33 ` Peter Maydell
@ 2024-01-24 1:36 ` Peter Xu
2024-01-24 6:47 ` Markus Armbruster
0 siblings, 1 reply; 5+ messages in thread
From: Peter Xu @ 2024-01-24 1:36 UTC (permalink / raw)
To: Peter Maydell; +Cc: Markus Armbruster, qemu-devel, farosas, het.gala
On Tue, Jan 23, 2024 at 04:33:43PM +0000, Peter Maydell wrote:
> On Wed, 17 Jan 2024 at 19:49, Markus Armbruster <armbru@redhat.com> wrote:
> >
> > 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 1533124
>
> Isn't this 1533125 ? 1533124 is a false positive in
> the migrate_mode() function.
Indeed.. I fixed it in the staging branch (which will be in the final
pull), thanks.
https://gitlab.com/peterx/qemu/-/commit/74278c11b980429916116baf0f742357af51ebb4
--
Peter Xu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] migration: Plug memory leak on HMP migrate error path
2024-01-24 1:36 ` Peter Xu
@ 2024-01-24 6:47 ` Markus Armbruster
0 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2024-01-24 6:47 UTC (permalink / raw)
To: Peter Xu; +Cc: Peter Maydell, qemu-devel, farosas, het.gala
Peter Xu <peterx@redhat.com> writes:
> On Tue, Jan 23, 2024 at 04:33:43PM +0000, Peter Maydell wrote:
>> On Wed, 17 Jan 2024 at 19:49, Markus Armbruster <armbru@redhat.com> wrote:
>> >
>> > 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 1533124
>>
>> Isn't this 1533125 ? 1533124 is a false positive in
>> the migrate_mode() function.
Yes.
> Indeed.. I fixed it in the staging branch (which will be in the final
> pull), thanks.
>
> https://gitlab.com/peterx/qemu/-/commit/74278c11b980429916116baf0f742357af51ebb4
Thanks for catching & fixing my typo!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-24 6:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-17 14:07 [PATCH] migration: Plug memory leak on HMP migrate error path Markus Armbruster
2024-01-18 6:58 ` Peter Xu
2024-01-23 16:33 ` Peter Maydell
2024-01-24 1:36 ` Peter Xu
2024-01-24 6:47 ` Markus Armbruster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).