mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-02 22:41:07 +00:00
ppc: fix memory leak in spapr_caps_add_properties
Free the capability name string after setting the capability. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Message-Id: <156335156198.82682.8756968724044750843.stgit@lep8c.aus.stglabs.ibm.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1872588ede
commit
d758880586
1 changed files with 3 additions and 1 deletions
|
@ -793,7 +793,7 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp)
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(capability_table); i++) {
|
||||
SpaprCapabilityInfo *cap = &capability_table[i];
|
||||
const char *name = g_strdup_printf("cap-%s", cap->name);
|
||||
char *name = g_strdup_printf("cap-%s", cap->name);
|
||||
char *desc;
|
||||
|
||||
object_class_property_add(klass, name, cap->type,
|
||||
|
@ -801,11 +801,13 @@ void spapr_caps_add_properties(SpaprMachineClass *smc, Error **errp)
|
|||
NULL, cap, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
g_free(name);
|
||||
return;
|
||||
}
|
||||
|
||||
desc = g_strdup_printf("%s", cap->description);
|
||||
object_class_property_set_description(klass, name, desc, &local_err);
|
||||
g_free(name);
|
||||
g_free(desc);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
|
|
Loading…
Reference in a new issue