hw/ppc/spapr_drc.c: use g_autofree in drc_unrealize()

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220228175004.8862-9-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
Daniel Henrique Barboza 2022-03-02 06:51:39 +01:00 committed by Cédric Le Goater
parent 37deca77a6
commit ef2ece4a87

View File

@ -544,15 +544,13 @@ static void drc_realize(DeviceState *d, Error **errp)
static void drc_unrealize(DeviceState *d) static void drc_unrealize(DeviceState *d)
{ {
SpaprDrc *drc = SPAPR_DR_CONNECTOR(d); SpaprDrc *drc = SPAPR_DR_CONNECTOR(d);
g_autofree gchar *name = g_strdup_printf("%x", spapr_drc_index(drc));
Object *root_container; Object *root_container;
gchar *name;
trace_spapr_drc_unrealize(spapr_drc_index(drc)); trace_spapr_drc_unrealize(spapr_drc_index(drc));
vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc); vmstate_unregister(VMSTATE_IF(drc), &vmstate_spapr_drc, drc);
root_container = container_get(object_get_root(), DRC_CONTAINER_PATH); root_container = container_get(object_get_root(), DRC_CONTAINER_PATH);
name = g_strdup_printf("%x", spapr_drc_index(drc));
object_property_del(root_container, name); object_property_del(root_container, name);
g_free(name);
} }
SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type, SpaprDrc *spapr_dr_connector_new(Object *owner, const char *type,