aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-12-20 23:21:07 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2014-01-06 13:45:47 -0500
commit28ec2598ff7d74bd9556a1786f45fc5df2aacfe1 (patch)
treeefc4bddd7c521b039b02b8d18b5c9e8d5c597286 /vl.c
parent513b8c74c4c899cd940a79131e76c5568aa11381 (diff)
qom: fix leak for objects created with -object
The object must be unref-ed when its variable goes out of scope. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 0f6754561e..2170a5e94c 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;
}