qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug obj


From: Gonglei
Subject: [Qemu-devel] [PATCH for-2.8] qom: fix qemu_opts leak when hot unplug object
Date: Wed, 23 Nov 2016 19:49:51 +0800

If we assign the user crateable object in QEMU command
line, then the correspeonding qemu_opts for the object
doesn't be deleted, which will produce a wrong result.

If we hot unplug the object by object_del, the qemu_opts
will be leaked, ann then if we hot plug the object using
the same id by object_add, we will get a error:
 "Duplicate ID 'xxxx' for object"

Let's del the qemu opts after the object created, just
likes what the hmp_object_add function does.

Signed-off-by: Gonglei <address@hidden>
---
 qom/object_interfaces.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index ded4d84..b8fe9db 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -189,6 +189,10 @@ int user_creatable_add_opts_foreach(void *opaque, QemuOpts 
*opts, Error **errp)
         return -1;
     }
     object_unref(obj);
+
+    qemu_opts_del(opts);
+    opts = NULL;
+
     return 0;
 }
 
-- 
1.8.3.1





reply via email to

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