If a property name is overloaded all instances should be deleted by the
deleter.

Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com>
---
 qom/object.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index 46abf41..967ed0d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -798,21 +798,23 @@ ObjectProperty *object_property_find(Object *obj, const 
char *name,
 
 void object_property_del(Object *obj, const char *name, Error **errp)
 {
-    ObjectProperty *prop = object_property_find(obj, name, errp);
-    if (prop == NULL) {
-        return;
-    }
+    for (;;) {
+        ObjectProperty *prop = object_property_find(obj, name, errp);
+        if (prop == NULL) {
+            return;
+        }
 
-    if (prop->release) {
-        prop->release(obj, name, prop->opaque);
-    }
+        if (prop->release) {
+            prop->release(obj, name, prop->opaque);
+        }
 
-    QTAILQ_REMOVE(&obj->properties, prop, node);
+        QTAILQ_REMOVE(&obj->properties, prop, node);
 
-    g_free(prop->name);
-    g_free(prop->type);
-    g_free(prop->description);
-    g_free(prop);
+        g_free(prop->name);
+        g_free(prop->type);
+        g_free(prop->description);
+        g_free(prop);
+    }
 }
 
 void object_property_get(Object *obj, Visitor *v, const char *name,
-- 
2.4.3.3.g905f831


Reply via email to