summaryrefslogtreecommitdiff
path: root/hw/intc/xics.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2017-09-12 00:04:40 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2017-09-15 10:29:48 +1000
commita1a6bbde4f6a29368f8f605cea2e73630ec1bc7c (patch)
tree3df3df454f3c0aab4b8e0b7dca9439ff3a003016 /hw/intc/xics.c
parente100161b69f8cf56dae866912dfffe7dcd7140af (diff)
xics: fix several error leaks
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 <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/intc/xics.c')
-rw-r--r--hw/intc/xics.c12
1 files 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);