[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 12/18] xics: fix several error leaks
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 12/18] xics: fix several error leaks |
Date: |
Fri, 15 Sep 2017 13:51:24 +1000 |
From: Greg Kurz <address@hidden>
If object_property_get_link() fails then it allocates an error, which
must be freed before returning. The error_get_pretty() function is
merely an accessor to the error message and doesn't free anything.
The error.h header indicates how to do it right:
* Pass an existing error to the caller with the message modified:
* error_propagate(errp, err);
* error_prepend(errp, "Could not frobnicate '%s': ", name);
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/intc/xics.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index a84ba51ad8..80c33be02e 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -306,8 +306,8 @@ static void icp_realize(DeviceState *dev, Error **errp)
obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err);
if (!obj) {
- error_setg(errp, "%s: required link '" ICP_PROP_XICS "' not found: %s",
- __func__, error_get_pretty(err));
+ error_propagate(errp, err);
+ error_prepend(errp, "required link '" ICP_PROP_XICS "' not found: ");
return;
}
@@ -315,8 +315,8 @@ static void icp_realize(DeviceState *dev, Error **errp)
obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err);
if (!obj) {
- error_setg(errp, "%s: required link '" ICP_PROP_CPU "' not found: %s",
- __func__, error_get_pretty(err));
+ error_propagate(errp, err);
+ error_prepend(errp, "required link '" ICP_PROP_CPU "' not found: ");
return;
}
@@ -641,8 +641,8 @@ static void ics_base_realize(DeviceState *dev, Error **errp)
obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &err);
if (!obj) {
- error_setg(errp, "%s: required link '" ICS_PROP_XICS "' not found: %s",
- __func__, error_get_pretty(err));
+ error_propagate(errp, err);
+ error_prepend(errp, "required link '" ICS_PROP_XICS "' not found: ");
return;
}
ics->xics = XICS_FABRIC(obj);
--
2.13.5
- [Qemu-ppc] [PULL 13/18] spapr_cpu_core: fail gracefully with non-pseries machine types, (continued)
- [Qemu-ppc] [PULL 13/18] spapr_cpu_core: fail gracefully with non-pseries machine types, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 10/18] spapr_pci: handle FDT creation errors with _FDT(), David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 11/18] vfio, spapr: Fix levels calculation, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 02/18] hw/ppc/spapr.c: cleaning up qdev_get_machine() calls, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 05/18] spapr_pci: use g_strdup_printf(), David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 14/18] spapr_pci: convert sprintf() to g_strdup_printf(), David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 04/18] spapr_pci: drop useless check in spapr_populate_pci_child_dt(), David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 07/18] ppc/xive: fix OV5_XIVE_EXPLOIT bits, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 15/18] spapr_pci: don't create 64-bit MMIO window if we don't need to, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 06/18] spapr: only update SDR1 once per-cpu during CAS, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 12/18] xics: fix several error leaks,
David Gibson <=
- [Qemu-ppc] [PULL 16/18] spapr_cpu_core: cleaning up qdev_get_machine() calls, David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 18/18] ppc/kvm: use kvm_vm_check_extension() in kvmppc_is_pr(), David Gibson, 2017/09/14
- [Qemu-ppc] [PULL 01/18] net: Add SunGEM device emulation as found on Apple UniNorth, David Gibson, 2017/09/14
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/18] ppc-for-2.11 queue 20170915, no-reply, 2017/09/15
- Re: [Qemu-ppc] [PULL 00/18] ppc-for-2.11 queue 20170915, Peter Maydell, 2017/09/15