[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 12/42] ppc: fix memory leak in spapr_caps_add_propert
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 12/42] ppc: fix memory leak in spapr_caps_add_properties |
Date: |
Wed, 21 Aug 2019 17:25:12 +1000 |
From: Shivaprasad G Bhat <address@hidden>
Free the capability name string after setting
the capability.
Signed-off-by: Shivaprasad G Bhat <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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 a61bf329bf..481dfd2a27 100644
--- a/hw/ppc/spapr_caps.c
+++ b/hw/ppc/spapr_caps.c
@@ -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);
--
2.21.0
- [Qemu-devel] [PULL 11/42] target/ppc: Optimize emulation of vclzw instruction, (continued)
- [Qemu-devel] [PULL 11/42] target/ppc: Optimize emulation of vclzw instruction, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 10/42] target/ppc: Optimize emulation of vclzd instruction, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 03/42] hw: add compat machines for 4.2, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 06/42] target/ppc: Optimize emulation of lvsl and lvsr instructions, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 09/42] target/ppc: Optimize emulation of vgbbd instruction, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 08/42] target/ppc: move opcode decode tables to PowerPCCPU, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 19/42] docs/specs: initial spec summary for Ultravisor-related hcalls, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 07/42] target/ppc: Optimize emulation of vsl and vsr instructions, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 16/42] spapr: Implement H_PROD, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 15/42] spapr: Implement dispatch tracking for tcg, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 12/42] ppc: fix memory leak in spapr_caps_add_properties,
David Gibson <=
- [Qemu-devel] [PULL 13/42] ppc: fix memory leak in spapr_dt_drc(), David Gibson, 2019/08/21
- [Qemu-devel] [PULL 14/42] ppc: fix leak in h_client_architecture_support, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 26/42] ppc/xive: Provide unconditional escalation support, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 18/42] spapr: Implement H_JOIN, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 33/42] spapr/pci: Consolidate de-allocation of MSIs, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 17/42] spapr: Implement H_CONFER, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 20/42] spapr: initial implementation for H_TPM_COMM/spapr-tpm-proxy, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 29/42] machine: Add wakeup method to MachineClass, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 23/42] ppc/xive: Implement TM_PULL_OS_CTX special command, David Gibson, 2019/08/21
- [Qemu-devel] [PULL 34/42] spapr/pci: Free MSIs during reset, David Gibson, 2019/08/21