diff --git a/target/s390x/helper.c b/target/s390x/helper.c index c41aa4c4ff819fb3929660ed508ab0866446376a..9ff7ff4acc9dce4f8bc03d83a887c865accdc5af 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -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;