From c64bf1887252aa8baee02d6d6d6ee024c4c451f5 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 19 Sep 2011 15:17:26 +0100 Subject: [PATCH] Zero-initialize DBusCounter at allocation Bug: https://bugs.freedesktop.org/show_bug.cgi?id=46095 Signed-off-by: Simon McVittie Reviewed-by: Guillaume Desmottes --- dbus/dbus-resources.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/dbus/dbus-resources.c b/dbus/dbus-resources.c index 42aedf5..80fb55b 100644 --- a/dbus/dbus-resources.c +++ b/dbus/dbus-resources.c @@ -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; } -- 2.7.4