[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/4] ppc: fix memory leak in spapr_caps_add_p
From: |
David Gibson |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/4] ppc: fix memory leak in spapr_caps_add_properties |
Date: |
Thu, 18 Jul 2019 14:19:19 +1000 |
User-agent: |
Mutt/1.12.0 (2019-05-25) |
On Wed, Jul 17, 2019 at 03:19:43AM -0500, Shivaprasad G Bhat wrote:
> Free the capability name string after setting
> the capability.
>
> Signed-off-by: Shivaprasad G Bhat <address@hidden>
Applied to ppc-for-4.2, thanks.
> ---
> hw/ppc/spapr_caps.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index bbb001f84a..0263c78d69 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -778,7 +778,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,
> @@ -786,11 +786,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);
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature