migration: Plug memory leak on HMP migrate error path
PATCH 1/1 migration: Plug memory leak on HMP migrate error path
hmp_migrate() leaks @caps when qmp_migrate() fails. Plug the leak with g_autoptr().
--- migration/migration-hmp-cmds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
migration/migration-hmp-cmds.c +1 -3
@@ -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;
Signature · 1 line
2.43.0
Peter Xu
AppliedQuoted 6 lines · Markus Armbruster
hmp_migrate()leaks @caps whenqmp_migrate()fails. Plug the leak withg_autoptr().Fixes 967f2de5c9ec (migration: Implement MigrateChannelList to hmp migration flow.) v8.2.0-rc0Fixes CID 1533124Signed-off-by Markus Armbruster <[email protected]>
queued, thanks!
Signature · 1 line
Peter Xu
Quoted 6 lines · Markus Armbruster
hmp_migrate()leaks @caps whenqmp_migrate()fails. Plug the leak withg_autoptr().Fixes 967f2de5c9ec (migration: Implement MigrateChannelList to hmp migration flow.) v8.2.0-rc0Fixes CID 1533124
Isn't this 1533125 ? 1533124 is a false positive in the migrate_mode() function.
Quoted 19 lines
Signed-off-by Markus Armbruster <[email protected]>--- migration/migration-hmp-cmds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)migration/migration-hmp-cmds.c +1
-1@@ -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) {
migration/migration-hmp-cmds.c void hmp_migrate(Monitor *mon, const QDict *qdict) · line 793
Quoted 7 lines
migration/migration-hmp-cmds.c +0
-2@@ -789,8 +789,6 @@ void hmp_migrate(Monitor *mon, const QDict *qdict)return ; } -qapi_free_MigrationChannelList (caps); -if (!detach) {HMPMigrationStatus *status;
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster
hmp_migrate()leaks @caps whenqmp_migrate()fails. Plug the leak withg_autoptr().Fixes 967f2de5c9ec (migration: Implement MigrateChannelList to hmp migration flow.) v8.2.0-rc0Fixes CID 1533124Isn'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
Signature · 1 line
Peter Xu
Quoted 11 lines · Peter Xu
Quoted 10 lines · Peter Maydell
Quoted 6 lines · Markus Armbruster
hmp_migrate()leaks @caps whenqmp_migrate()fails. Plug the leak withg_autoptr().Fixes 967f2de5c9ec (migration: Implement MigrateChannelList to hmp migration flow.) v8.2.0-rc0Fixes CID 1533124Isn't this 1533125 ? 1533124 is a false positive in the
migrate_mode()function.
Yes.
Quoted 4 lines
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!