qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 04/14] qom: fix leak for objects created with -object


From: Luiz Capitulino
Subject: [Qemu-devel] [PULL 04/14] qom: fix leak for objects created with -object
Date: Mon, 6 Jan 2014 17:03:05 -0500

From: Paolo Bonzini <address@hidden>

The object must be unref-ed when its variable goes out of scope.

Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Igor Mammedov <address@hidden>
Tested-by: Igor Mammedov <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
 vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vl.c b/vl.c
index 0f67545..2170a5e 100644
--- a/vl.c
+++ b/vl.c
@@ -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;
 }
 
-- 
1.8.1.4




reply via email to

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