Skip to content

Commit

Permalink
hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties()
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220228175004.8862-6-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
danielhb authored and legoater committed Mar 2, 2022
1 parent bc940c4 commit 37d1953
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions hw/ppc/spapr_caps.c
Expand Up @@ -930,16 +930,13 @@ void spapr_caps_add_properties(SpaprMachineClass *smc)

for (i = 0; i < ARRAY_SIZE(capability_table); i++) {
SpaprCapabilityInfo *cap = &capability_table[i];
char *name = g_strdup_printf("cap-%s", cap->name);
char *desc;
g_autofree char *name = g_strdup_printf("cap-%s", cap->name);
g_autofree char *desc = g_strdup_printf("%s", cap->description);

object_class_property_add(klass, name, cap->type,
cap->get, cap->set,
NULL, cap);

desc = g_strdup_printf("%s", cap->description);
object_class_property_set_description(klass, name, desc);
g_free(name);
g_free(desc);
}
}

0 comments on commit 37d1953

Please sign in to comment.