]> Git Repo - qemu.git/commitdiff
qom: fix leak for objects created with -object
authorPaolo Bonzini <[email protected]>
Fri, 20 Dec 2013 22:21:07 +0000 (23:21 +0100)
committerLuiz Capitulino <[email protected]>
Mon, 6 Jan 2014 18:45:47 +0000 (13:45 -0500)
The object must be unref-ed when its variable goes out of scope.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Tested-by: Igor Mammedov <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
vl.c

diff --git a/vl.c b/vl.c
index 0f6754561e36ae671ae12643f336bb736564bbc2..2170a5e94ce2951f0aaf9b0af56c62dbcab41ef0 100644 (file)
--- 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;
 }
 
This page took 0.031393 seconds and 4 git commands to generate.