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: Igor Mammedov <imammedo@redhat.com>
Message-Id: <
1508247680-98800-2-git-send-email-imammedo@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
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;