aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/qom/object.c b/qom/object.c
index 3290375016..a2a1ffa1b3 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1303,6 +1303,7 @@ void object_property_add_str(Object *obj, const char *name,
void (*set)(Object *, const char *, Error **),
Error **errp)
{
+ Error *local_err = NULL;
StringProperty *prop = g_malloc0(sizeof(*prop));
prop->get = get;
@@ -1312,7 +1313,11 @@ void object_property_add_str(Object *obj, const char *name,
get ? property_get_str : NULL,
set ? property_set_str : NULL,
property_release_str,
- prop, errp);
+ prop, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ g_free(prop);
+ }
}
typedef struct BoolProperty
@@ -1359,6 +1364,7 @@ void object_property_add_bool(Object *obj, const char *name,
void (*set)(Object *, bool, Error **),
Error **errp)
{
+ Error *local_err = NULL;
BoolProperty *prop = g_malloc0(sizeof(*prop));
prop->get = get;
@@ -1368,7 +1374,11 @@ void object_property_add_bool(Object *obj, const char *name,
get ? property_get_bool : NULL,
set ? property_set_bool : NULL,
property_release_bool,
- prop, errp);
+ prop, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ g_free(prop);
+ }
}
static char *qdev_get_type(Object *obj, Error **errp)