From: Corey Minyard <cminy...@mvista.com> When setting an object, if you don't release the previous object that was there, it may become unusable. This change allows a chardev to be removed from one object's properties and added to another's.
Signed-off-by: Corey Minyard <cminy...@mvista.com> Acked-by: Paolo Bonzini <pbonz...@redhat.com> --- qom/object.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/qom/object.c b/qom/object.c index e3e9242..6bbb6a8 100644 --- a/qom/object.c +++ b/qom/object.c @@ -692,6 +692,9 @@ void object_property_set(Object *obj, Visitor *v, const char *name, if (!prop->set) { error_set(errp, QERR_PERMISSION_DENIED); } else { + if (prop->release) { + prop->release(obj, name, prop->opaque); + } prop->set(obj, v, prop->opaque, name, errp); } } -- 1.7.4.1