提交 ac7e4cbb 编写于 作者: I Igor Mammedov 提交者: Cornelia Huck

s390x: fix cpu object referrence leak in s390x_new_cpu()

object_new() returns cpu with refcnt == 1 and after realize
refcnt == 2*. s390x_new_cpu() as an owner of the first refcnt
should have released it on exit in both cases (on error and
success) to avoid it leaking. Do so for both cases.
Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
Message-Id: <1508247680-98800-2-git-send-email-imammedo@redhat.com>
Signed-off-by: NCornelia Huck <cohuck@redhat.com>
上级 67915de9
......@@ -73,9 +73,9 @@ S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp)
object_property_set_bool(OBJECT(cpu), true, "realized", &err);
out:
object_unref(OBJECT(cpu));
if (err) {
error_propagate(errp, err);
object_unref(OBJECT(cpu));
cpu = NULL;
}
return cpu;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册