diff mbox series

[2/3] vl.c: select_machine(): use g_autoptr

Message ID 20240626134305.432627-3-vsementsov@yandex-team.ru (mailing list archive)
State New, archived
Headers show
Series vl.c: select_machine(): improve error message | expand

Commit Message

Vladimir Sementsov-Ogievskiy June 26, 2024, 1:43 p.m. UTC
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 system/vl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/system/vl.c b/system/vl.c
index fa81037ce2..947b433905 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -1667,7 +1667,7 @@  static MachineClass *select_machine(QDict *qdict, Error **errp)
 {
     ERRP_GUARD();
     const char *machine_type = qdict_get_try_str(qdict, "type");
-    GSList *machines = object_class_get_list(TYPE_MACHINE, false);
+    g_autoptr(GSList) machines = object_class_get_list(TYPE_MACHINE, false);
     MachineClass *machine_class = NULL;
 
     if (machine_type) {
@@ -1683,7 +1683,6 @@  static MachineClass *select_machine(QDict *qdict, Error **errp)
         }
     }
 
-    g_slist_free(machines);
     if (!machine_class) {
         error_append_hint(errp,
                           "Use -machine help to list supported machines\n");