提交 28ec2598 编写于 作者: P Paolo Bonzini 提交者: Luiz Capitulino

qom: fix leak for objects created with -object

The object must be unref-ed when its variable goes out of scope.
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: NIgor Mammedov <imammedo@redhat.com>
Tested-by: NIgor Mammedov <imammedo@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 513b8c74
......@@ -2810,12 +2810,13 @@ static int object_create(QemuOpts *opts, void *opaque)
obj = object_new(type);
if (qemu_opt_foreach(opts, object_set_property, obj, 1) < 0) {
object_unref(obj);
return -1;
}
object_property_add_child(container_get(object_get_root(), "/objects"),
id, obj, NULL);
object_unref(obj);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册