Patchwork qom: Fix object_class_foreach()

login
register
mail settings
Submitter Andreas Färber
Date Jan. 28, 2012, 4:48 p.m.
Message ID <1327769339-24875-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/138396/
State New
Headers show

Comments

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

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),