qom: Fix object_class_foreach()

Submitted by Andreas Färber on Jan. 28, 2012, 4:48 p.m.

Details

Message ID 1327769339-24875-1-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Jan. 28, 2012, 4:48 p.m.
The TypeImpl was passed as ObjectClass and the ObjectClass as opaque,
leading to segfault when dereferencing the caller-supplied opaque.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 qom/object.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch hide | download patch | download mbox

diff --git a/qom/object.c b/qom/object.c
index a12895f..57cc592 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -478,7 +478,7 @@  static void object_class_foreach_tramp(gpointer key, gpointer value,
 
     type_class_init(type);
 
-    data->fn(value, type->class);
+    data->fn(type->class, data->opaque);
 }
 
 void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),