diff options
Diffstat (limited to 'qom')
-rw-r--r-- | qom/object.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qom/object.c b/qom/object.c index d5c6ff7471..27cc651a91 100644 --- a/qom/object.c +++ b/qom/object.c @@ -689,9 +689,16 @@ void object_property_del(Object *obj, const char *name, Error **errp) { ObjectProperty *prop = object_property_find(obj, name); - QTAILQ_REMOVE(&obj->properties, prop, node); + if (prop == NULL) { + error_set(errp, QERR_PROPERTY_NOT_FOUND, "", name); + return; + } + + if (prop->release) { + prop->release(obj, name, prop->opaque); + } - prop->release(obj, prop->name, prop->opaque); + QTAILQ_REMOVE(&obj->properties, prop, node); g_free(prop->name); g_free(prop->type); |