Zero-initialize DBusCounter at allocation
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 19 Sep 2011 14:17:26 +0000 (15:17 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 21 Feb 2012 14:51:18 +0000 (14:51 +0000)
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
dbus/dbus-resources.c

index 42aedf5..80fb55b 100644 (file)
@@ -89,25 +89,12 @@ _dbus_counter_new (void)
 {
   DBusCounter *counter;
 
-  counter = dbus_new (DBusCounter, 1);
+  counter = dbus_new0 (DBusCounter, 1);
   if (counter == NULL)
     return NULL;
-  
-  counter->refcount = 1;
-  counter->size_value = 0;
-  counter->unix_fd_value = 0;
 
-#ifdef DBUS_ENABLE_STATS
-  counter->peak_size_value = 0;
-  counter->peak_unix_fd_value = 0;
-#endif
+  counter->refcount = 1;
 
-  counter->notify_size_guard_value = 0;
-  counter->notify_unix_fd_guard_value = 0;
-  counter->notify_function = NULL;
-  counter->notify_data = NULL;
-  counter->notify_pending = FALSE;
-  
   return counter;
 }