From be0f8e978dd59e99318925bdf3fea75be97a1710 Mon Sep 17 00:00:00 2001 From: Paolo Borelli Date: Sat, 24 Nov 2007 14:18:48 +0000 Subject: check for NULL before dereferencing. 2007-11-24 Paolo Borelli * gobject/gobjectmodule.c (pyg_type_register): check for NULL before dereferencing. svn path=/trunk/; revision=720 --- ChangeLog | 5 +++++ gobject/gobjectmodule.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index eaf40e6..9751456 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-11-24 Paolo Borelli + + * gobject/gobjectmodule.c (pyg_type_register): check for NULL before + dereferencing. + 2007-11-24 Paolo Borelli * gobject/gobjectmodule.c (pyg_type_register): do not use a diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 9d78bf8..b21087d 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1301,7 +1301,7 @@ pyg_type_register(PyTypeObject *class, const char *type_name) const GInterfaceInfo *iinfo; GInterfaceInfo iinfo_copy; guint parent_interface_iter; - + if (((PyTypeObject *) base)->tp_base != &PyGInterface_Type) continue; @@ -1321,8 +1321,6 @@ pyg_type_register(PyTypeObject *class, const char *type_name) continue; iinfo = pyg_lookup_interface_info(itype); - iinfo_copy = *iinfo; - iinfo_copy.interface_data = class; if (!iinfo) { char *msg; msg = g_strdup_printf("Interface type %s " @@ -1332,6 +1330,9 @@ pyg_type_register(PyTypeObject *class, const char *type_name) g_free(msg); continue; } + + iinfo_copy = *iinfo; + iinfo_copy.interface_data = class; g_type_add_interface_static(instance_type, itype, &iinfo_copy); } } else @@ -1392,7 +1393,7 @@ pyg_type_register(PyTypeObject *class, const char *type_name) const GInterfaceInfo *iinfo; GInterfaceInfo iinfo_copy; guint parent_interface_iter; - + if (((PyTypeObject *) base)->tp_base != &PyGInterface_Type) continue; @@ -1413,8 +1414,6 @@ pyg_type_register(PyTypeObject *class, const char *type_name) } iinfo = pyg_lookup_interface_info(itype); - iinfo_copy = *iinfo; - iinfo_copy.interface_data = class; if (!iinfo) { char *msg; msg = g_strdup_printf("Interface type %s " @@ -1424,6 +1423,9 @@ pyg_type_register(PyTypeObject *class, const char *type_name) g_free(msg); continue; } + + iinfo_copy = *iinfo; + iinfo_copy.interface_data = class; g_type_add_interface_static(instance_type, itype, &iinfo_copy); } } else -- cgit