diff options
Diffstat (limited to 'monitor/hmp-cmds.c')
-rw-r--r-- | monitor/hmp-cmds.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 65d8ff4..73b79df 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -1255,7 +1255,8 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) const char *cap = qdict_get_str(qdict, "capability"); bool state = qdict_get_bool(qdict, "state"); Error *err = NULL; - MigrationCapabilityStatusList *caps = g_malloc0(sizeof(*caps)); + MigrationCapabilityStatusList *caps = NULL; + MigrationCapabilityStatus *value; int val; val = qapi_enum_parse(&MigrationCapability_lookup, cap, -1, &err); @@ -1263,14 +1264,14 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) goto end; } - caps->value = g_malloc0(sizeof(*caps->value)); - caps->value->capability = val; - caps->value->state = state; - caps->next = NULL; + value = g_malloc0(sizeof(*value)); + value->capability = val; + value->state = state; + QAPI_LIST_PREPEND(caps, value); qmp_migrate_set_capabilities(caps, &err); + qapi_free_MigrationCapabilityStatusList(caps); end: - qapi_free_MigrationCapabilityStatusList(caps); hmp_handle_error(mon, err); } |