[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] qom: add error handler for object alias propert
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH 2/2] qom: add error handler for object alias property |
Date: |
Tue, 23 Sep 2014 11:25:50 +0800 |
From: Gonglei <address@hidden>
object_property_add_alias() is called at some
places at present. And its parameter errp may not NULL,
such as
object_property_add_alias(obj, "iothread", OBJECT(&dev->vdev),"iothread",
&error_abort);
This patch add error handler for security.
Cc: Stefan Hajnoczi <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Michael S. Tsirkin <address@hidden>
Cc: Markus Armbruster <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
---
qom/object.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/qom/object.c b/qom/object.c
index 74779e6..81542fb 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1642,6 +1642,7 @@ void object_property_add_alias(Object *obj, const char
*name,
ObjectProperty *op;
ObjectProperty *target_prop;
gchar *prop_type;
+ Error *local_err = NULL;
target_prop = object_property_find(target_obj, target_name, errp);
if (!target_prop) {
@@ -1663,9 +1664,15 @@ void object_property_add_alias(Object *obj, const char
*name,
property_get_alias,
property_set_alias,
property_release_alias,
- prop, errp);
+ prop, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ g_free(prop);
+ goto out;
+ }
op->resolve = property_resolve_alias;
+out:
g_free(prop_type);
}
--
1.7.12.4