[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-s390x] [PULL 35/46] s390x: fix cpu object referrence leak in s390x

From: Cornelia Huck
Subject: [qemu-s390x] [PULL 35/46] s390x: fix cpu object referrence leak in s390x_new_cpu()
Date: Fri, 20 Oct 2017 13:54:07 +0200

From: Igor Mammedov <address@hidden>

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 <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
 target/s390x/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index c41aa4c4ff..9ff7ff4acc 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);
+    object_unref(OBJECT(cpu));
     if (err) {
         error_propagate(errp, err);
-        object_unref(OBJECT(cpu));
         cpu = NULL;
     return cpu;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]