From 4b8b30907f4e0b465de8655c200aa1e38e60dd23 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 20 Jan 2007 17:22:04 +0000 Subject: [PATCH] * Initialize more variables during declaration, in the hope of suppressing Valgrind warnings --- citadel/database_sleepycat.c | 6 +++--- citadel/serv_extensions.c | 10 ++++++---- citadel/serv_vcard.c | 2 +- citadel/user_ops.c | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index 6038d5869..e29ce5b08 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -554,14 +554,14 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen) DBT dkey, ddata; DB_TXN *tid; - int ret; + int ret = 0; #ifdef HAVE_ZLIB struct CtdlCompressHeader zheader; char *compressed_data = NULL; int compressing = 0; - size_t buffer_len; - uLongf destLen; + size_t buffer_len = 0; + uLongf destLen = 0; #endif memset(&dkey, 0, sizeof(DBT)); diff --git a/citadel/serv_extensions.c b/citadel/serv_extensions.c index 5c2ce3867..44a1dccea 100644 --- a/citadel/serv_extensions.c +++ b/citadel/serv_extensions.c @@ -170,7 +170,9 @@ void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc) void CtdlUnregisterProtoHook(void (*handler) (char *), char *cmd) { - struct ProtoFunctionHook *cur, *p, *lastcur; + struct ProtoFunctionHook *cur = NULL; + struct ProtoFunctionHook *p = NULL; + struct ProtoFunctionHook *lastcur = NULL; for (cur = ProtoHookList; cur != NULL; @@ -819,7 +821,7 @@ void CtdlDestroyServiceHook(void) void PerformSessionHooks(int EventType) { - struct SessionFunctionHook *fcn; + struct SessionFunctionHook *fcn = NULL; for (fcn = SessionHookTable; fcn != NULL; fcn = fcn->next) { if (fcn->eventtype == EventType) { @@ -830,7 +832,7 @@ void PerformSessionHooks(int EventType) void PerformUserHooks(struct ctdluser *usbuf, int EventType) { - struct UserFunctionHook *fcn; + struct UserFunctionHook *fcn = NULL; for (fcn = UserHookTable; fcn != NULL; fcn = fcn->next) { if (fcn->eventtype == EventType) { @@ -841,7 +843,7 @@ void PerformUserHooks(struct ctdluser *usbuf, int EventType) int PerformMessageHooks(struct CtdlMessage *msg, int EventType) { - struct MessageFunctionHook *fcn; + struct MessageFunctionHook *fcn = NULL; int total_retval = 0; /* Other code may elect to protect this message from server-side diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index a4bee1482..9f67eea33 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -961,7 +961,7 @@ void vcard_create_room(void) * When a user logs in... */ void vcard_session_login_hook(void) { - struct vCard *v; + struct vCard *v = NULL; v = vcard_get_user(&CC->user); extract_primary_inet_email(CC->cs_inet_email, diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 9637c14c9..13e8db773 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -166,7 +166,7 @@ int GenerateRelationshipIndex(char *IndexBuf, void put_visit(struct visit *newvisit) { char IndexBuf[32]; - int IndexLen; + int IndexLen = 0; /* Generate an index */ IndexLen = GenerateRelationshipIndex(IndexBuf, @@ -462,7 +462,7 @@ void cmd_user(char *cmdbuf) */ void session_startup(void) { - int i; + int i = 0; lprintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user); -- 2.30.2