Check for 0-sized private data. (#443869)
authorCody Russell <bratsche@gnome.org>
Fri, 15 Jun 2007 03:50:27 +0000 (03:50 +0000)
committerCody Russell <bratsche@src.gnome.org>
Fri, 15 Jun 2007 03:50:27 +0000 (03:50 +0000)
2007-06-14  Cody Russell  <bratsche@gnome.org>

        * gobject/gtype.c (g_type_class_add_private): Check for 0-sized
        private data. (#443869)

svn path=/trunk/; revision=5561

ChangeLog
gobject/gtype.c

index be68393..77c3d25 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-06-14  Cody Russell  <bratsche@gnome.org>
+
+       * gobject/gtype.c (g_type_class_add_private): Check for 0-sized
+       private data. (#443869)
+
 2007-06-14  Matthias Clasen  <mclasen@redhat.com>
        
        * glib/gmain.c (g_timeout_add_seconds): Fix doc typos.  (#447534,
index 44620db..17a304d 100644 (file)
@@ -3483,6 +3483,8 @@ g_type_class_add_private (gpointer g_class,
   TypeNode *node = lookup_type_node_I (instance_type);
   gsize offset;
 
+  g_return_if_fail (private_size > 0);
+
   if (!node || !node->is_instantiatable || !node->data || node->data->class.class != g_class)
     {
       g_warning ("cannot add private field to invalid (non-instantiatable) type '%s'",