From: Richard Russon Date: Wed, 11 Jul 2018 22:02:53 +0000 (+0100) Subject: cocci checks X-Git-Tag: 2019-10-25~757^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=506a51d55fe89e728dc30da68983b0b821b54b8c;p=neomutt cocci checks --- diff --git a/alias.c b/alias.c index 5baf8dc1c..3388efc27 100644 --- a/alias.c +++ b/alias.c @@ -67,7 +67,7 @@ static struct Address *expand_aliases_r(struct Address *a, struct ListHead *expn if (t) { i = false; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, expn, entries) { if (mutt_str_strcmp(a->mailbox, np->data) == 0) /* alias already found */ diff --git a/color.c b/color.c index 77c00ee4d..5ddbc03ae 100644 --- a/color.c +++ b/color.c @@ -758,7 +758,7 @@ static int parse_object(struct Buffer *buf, struct Buffer *s, int *o, int *ql, if (*o == -1) { mutt_buffer_printf(err, _("%s: no such object"), buf->data); - return (-1); + return -1; } } else if ((*o = mutt_map_get_value(buf->data, Fields)) == -1) diff --git a/commands.c b/commands.c index 66fae3198..21db2d685 100644 --- a/commands.c +++ b/commands.c @@ -1030,7 +1030,7 @@ int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp) if (!TAILQ_EMPTY(&b->parameter)) { size_t l = strlen(buf); - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, &b->parameter, entries) { mutt_addr_cat(tmp, sizeof(tmp), np->value, MimeSpecials); diff --git a/compose.c b/compose.c index c2fdc3b59..b15c835b2 100644 --- a/compose.c +++ b/compose.c @@ -358,7 +358,7 @@ static void redraw_mix_line(struct ListHead *chain) } int c = 12; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, chain, entries) { t = np->data; diff --git a/conn/ssl.c b/conn/ssl.c index 2077444db..6294625cf 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -1307,7 +1307,7 @@ static int ssl_negotiate(struct Connection *conn, struct SslSockData *ssldata) */ static int ssl_setup(struct Connection *conn) { - struct SslSockData *ssldata; + struct SslSockData *ssldata = NULL; int maxbits; ssldata = mutt_mem_calloc(1, sizeof(struct SslSockData)); diff --git a/copy.c b/copy.c index 695778cf8..fca860c04 100644 --- a/copy.c +++ b/copy.c @@ -162,7 +162,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, */ if (flags & CH_REORDER) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &HeaderOrderList, entries) { mutt_debug(3, "Reorder list: %s\n", np->data); @@ -268,7 +268,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, /* Find x -- the array entry where this header is to be saved */ if (flags & CH_REORDER) { - struct ListNode *np; + struct ListNode *np = NULL; x = 0; STAILQ_FOREACH(np, &HeaderOrderList, entries) { @@ -427,7 +427,7 @@ int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const cha if ((flags & CH_UPDATE_IRT) && !STAILQ_EMPTY(&h->env->in_reply_to)) { fputs("In-Reply-To:", out); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &h->env->in_reply_to, entries) { fputc(' ', out); diff --git a/curs_main.c b/curs_main.c index c70ec99b7..17c9ec24b 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1276,7 +1276,7 @@ int mutt_index_menu(void) /* trying to find msgid of the root message */ if (op == OP_RECONSTRUCT_THREAD) { - struct ListNode *ref; + struct ListNode *ref = NULL; STAILQ_FOREACH(ref, &CURHDR->env->references, entries) { if (mutt_hash_find(Context->id_hash, ref->data) == NULL) diff --git a/email/parameter.c b/email/parameter.c index 41e699813..e38bda6cf 100644 --- a/email/parameter.c +++ b/email/parameter.c @@ -83,7 +83,7 @@ char *mutt_param_get(const struct ParameterList *p, const char *s) if (!p) return NULL; - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, p, entries) { if (mutt_str_strcasecmp(s, np->attribute) == 0) @@ -115,7 +115,7 @@ void mutt_param_set(struct ParameterList *p, const char *attribute, const char * return; } - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, p, entries) { if (mutt_str_strcasecmp(attribute, np->attribute) == 0) @@ -141,7 +141,7 @@ void mutt_param_delete(struct ParameterList *p, const char *attribute) if (!p) return; - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, p, entries) { if (mutt_str_strcasecmp(attribute, np->attribute) == 0) diff --git a/email/tags.c b/email/tags.c index 72f29dab7..5ba45fa53 100644 --- a/email/tags.c +++ b/email/tags.c @@ -55,7 +55,7 @@ static char *driver_tags_getter(struct TagHead *head, bool show_hidden, return NULL; char *tags = NULL; - struct TagNode *np; + struct TagNode *np = NULL; STAILQ_FOREACH(np, head, entries) { if (filter && mutt_str_strcmp(np->name, filter) != 0) @@ -197,7 +197,7 @@ bool driver_tags_replace(struct TagHead *head, char *tags) if (tags) { - char *tag; + char *tag = NULL; while ((tag = strsep(&tags, " "))) driver_tags_add(head, tag); FREE(&tags); diff --git a/email/thread.c b/email/thread.c index 27d02a7b3..5e2d81b46 100644 --- a/email/thread.c +++ b/email/thread.c @@ -199,7 +199,7 @@ void clean_references(struct MuttThread *brk, struct MuttThread *cur) struct Header *h = cur->message; /* clearing the References: header from obsolete Message-ID(s) */ - struct ListNode *np; + struct ListNode *np = NULL; while ((np = STAILQ_NEXT(ref, entries)) != NULL) { STAILQ_REMOVE_AFTER(&cur->message->env->references, ref, entries); diff --git a/handler.c b/handler.c index 3d3c5c03b..f5cf6202f 100644 --- a/handler.c +++ b/handler.c @@ -485,7 +485,7 @@ static bool is_autoview(struct Body *b) { /* determine if this type is on the user's auto_view list */ mutt_check_lookup_list(b, type, sizeof(type)); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &AutoViewList, entries) { int i = mutt_str_strlen(np->data) - 1; @@ -943,7 +943,7 @@ static int alternative_handler(struct Body *a, struct State *s) a = b; /* First, search list of preferred types */ - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &AlternativeOrderList, entries) { int btlen; /* length of basetype */ diff --git a/hcache/hcache.c b/hcache/hcache.c index c31bcf556..11ca90a26 100644 --- a/hcache/hcache.c +++ b/hcache/hcache.c @@ -366,7 +366,7 @@ static unsigned char *dump_stailq(struct ListHead *l, unsigned char *d, int *off d = dump_int(0xdeadbeef, d, off); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, l, entries) { d = dump_char(np->data, d, off, convert); @@ -391,7 +391,7 @@ static void restore_stailq(struct ListHead *l, const unsigned char *d, int *off, restore_int(&counter, d, off); - struct ListNode *np; + struct ListNode *np = NULL; while (counter) { np = mutt_list_insert_tail(l, NULL); @@ -470,7 +470,7 @@ static unsigned char *dump_parameter(struct ParameterList *p, unsigned char *d, d = dump_int(0xdeadbeef, d, off); - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, p, entries) { d = dump_char(np->attribute, d, off, false); @@ -497,7 +497,7 @@ static void restore_parameter(struct ParameterList *p, const unsigned char *d, restore_int(&counter, d, off); - struct Parameter *np; + struct Parameter *np = NULL; while (counter) { np = mutt_param_new(); diff --git a/history.c b/history.c index 9bb79bb6c..ede1fb90c 100644 --- a/history.c +++ b/history.c @@ -484,7 +484,7 @@ static void history_entry(char *buf, size_t buflen, struct Menu *menu, int num) */ static void history_menu(char *buf, size_t buflen, char **matches, int match_count) { - struct Menu *menu; + struct Menu *menu = NULL; int done = 0; char helpstr[LONG_STRING]; char title[STRING]; diff --git a/imap/imap.c b/imap/imap.c index 09713024a..d7d4bcfc9 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1145,7 +1145,7 @@ bool imap_has_flag(struct ListHead *flag_list, const char *flag) if (STAILQ_EMPTY(flag_list)) return false; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, flag_list, entries) { if (mutt_str_strncasecmp(np->data, flag, strlen(np->data)) == 0) @@ -1251,7 +1251,7 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr, struct Buffer *cmd, int *err_continue) { char flags[LONG_STRING]; - char *tags; + char *tags = NULL; char uid[11]; if (!compare_flags_for_copy(hdr)) @@ -1597,7 +1597,7 @@ struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox, void *uidnext = NULL; #endif - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &idata->mboxcache, entries) { status = (struct ImapStatus *) np->data; @@ -1654,7 +1654,7 @@ void imap_mboxcache_free(struct ImapData *idata) { struct ImapStatus *status = NULL; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &idata->mboxcache, entries) { status = (struct ImapStatus *) np->data; @@ -2160,7 +2160,7 @@ static int imap_mbox_open(struct Context *ctx) mutt_debug(3, "No folder flags found\n"); else { - struct ListNode *np; + struct ListNode *np = NULL; struct Buffer flag_buffer; mutt_buffer_init(&flag_buffer); mutt_buffer_printf(&flag_buffer, "Mailbox flags: "); diff --git a/imap/message.c b/imap/message.c index 6683e95e6..09881a04b 100644 --- a/imap/message.c +++ b/imap/message.c @@ -516,9 +516,9 @@ static void generate_seqset(struct Buffer *b, struct ImapData *idata, { int chunks = 0; int state = 0; /* 1: single msn, 2: range of msn */ - unsigned int msn, range_begin, range_end; + unsigned int range_begin, range_end; - for (msn = msn_begin; msn <= msn_end + 1; msn++) + for (unsigned int msn = msn_begin; msn <= msn_end + 1; msn++) { if (msn <= msn_end && !idata->msn_index[msn - 1]) { diff --git a/init.c b/init.c index 952b56026..f56f3f308 100644 --- a/init.c +++ b/init.c @@ -134,7 +134,7 @@ static void add_to_stailq(struct ListHead *head, const char *str) return; /* check to make sure the item is not already on this list */ - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, head, entries) { if (mutt_str_strcasecmp(str, np->data) == 0) @@ -387,7 +387,7 @@ static int execute_commands(struct ListHead *p) err.dsize = STRING; err.data = mutt_mem_malloc(err.dsize); mutt_buffer_init(&token); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, p, entries) { if (mutt_parse_rc_line(np->data, &token, &err) == -1) @@ -1022,7 +1022,7 @@ static void pretty_var(char *buf, size_t buflen, const char *option, const char */ static int print_attach_list(struct ListHead *h, char op, char *name) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, h, entries) { printf("attachments %c%s %s/%s\n", op, name, @@ -3943,7 +3943,7 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands) } else { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &Muttrc, entries) { mutt_str_strfcpy(buffer, np->data, sizeof(buffer)); @@ -3998,7 +3998,7 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands) } /* Read the user's initialization file. */ - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &Muttrc, entries) { if (np->data) @@ -4361,7 +4361,7 @@ int mutt_query_variables(struct ListHead *queries) err.dsize = STRING; err.data = mutt_mem_malloc(err.dsize); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, queries, entries) { snprintf(command, sizeof(command), "set ?%s\n", np->data); diff --git a/maildir/mh.c b/maildir/mh.c index 7ef174ce5..82ac51b8c 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -2186,7 +2186,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno) #ifdef USE_HCACHE if (hc) { - const char *key; + const char *key = NULL; size_t keylen; if (ctx->magic == MUTT_MH) { @@ -2234,7 +2234,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno) #ifdef USE_HCACHE if (hc && h->changed) { - const char *key; + const char *key = NULL; size_t keylen; if (ctx->magic == MUTT_MH) { diff --git a/main.c b/main.c index 6395cb23d..ab1b0045f 100644 --- a/main.c +++ b/main.c @@ -649,7 +649,7 @@ int main(int argc, char *argv[], char *envp[]) struct Address *a = NULL; for (; optind < argc; optind++) mutt_list_insert_tail(&alias_queries, mutt_str_strdup(argv[optind])); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &alias_queries, entries) { a = mutt_alias_lookup(np->data); @@ -922,7 +922,7 @@ int main(int argc, char *argv[], char *envp[]) while (a && a->next) a = a->next; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &attach, entries) { if (a) diff --git a/mutt/list.c b/mutt/list.c index 090f6d0d3..281568272 100644 --- a/mutt/list.c +++ b/mutt/list.c @@ -87,7 +87,7 @@ struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n, */ struct ListNode *mutt_list_find(struct ListHead *h, const char *data) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, h, entries) { if (np->data == data || mutt_str_strcmp(np->data, data) == 0) @@ -169,7 +169,7 @@ void mutt_list_clear(struct ListHead *h) */ bool mutt_list_match(const char *s, struct ListHead *h) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, h, entries) { if ((*np->data == '*') || (mutt_str_strncasecmp(s, np->data, strlen(np->data)) == 0)) diff --git a/mutt/rfc2047.c b/mutt/rfc2047.c index 97c521686..3cc8f5867 100644 --- a/mutt/rfc2047.c +++ b/mutt/rfc2047.c @@ -657,11 +657,11 @@ void mutt_rfc2047_decode(char **pd) struct Buffer buf = { 0 }; /* Output buffer */ char *s = *pd; /* Read pointer */ - char *beg; /* Begin of encoded word */ + char *beg = NULL; /* Begin of encoded word */ enum ContentEncoding enc; /* ENCBASE64 or ENCQUOTEDPRINTABLE */ - char *charset; /* Which charset */ + char *charset = NULL; /* Which charset */ size_t charsetlen; /* Length of the charset */ - char *text; /* Encoded text */ + char *text = NULL; /* Encoded text */ size_t textlen; /* Length of encoded text */ /* Keep some state in case the next decoded word is using the same charset @@ -714,7 +714,7 @@ void mutt_rfc2047_decode(char **pd) /* Some encoded text was found */ text[textlen] = '\0'; char *decoded = rfc2047_decode_word(text, textlen, enc); - if (decoded == NULL) + if (!decoded) { return; } diff --git a/mutt_attach.c b/mutt_attach.c index 0c9d450e6..74078d27d 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -314,7 +314,7 @@ bailout: */ void mutt_check_lookup_list(struct Body *b, char *type, size_t len) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &MimeLookupList, entries) { const int i = mutt_str_strlen(np->data) - 1; diff --git a/mutt_thread.c b/mutt_thread.c index 7fde461b3..628e71185 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -400,7 +400,7 @@ static void make_subject_list(struct ListHead *subjects, struct MuttThread *cur, env = cur->message->env; if (env->real_subj && ((env->real_subj != env->subject) || (!SortRe))) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, subjects, entries) { rc = mutt_str_strcmp(env->real_subj, np->data); @@ -441,7 +441,7 @@ static struct MuttThread *find_subject(struct Context *ctx, struct MuttThread *c make_subject_list(&subjects, cur, &date); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, &subjects, entries) { for (ptr = mutt_hash_find_bucket(ctx->subj_hash, np->data); ptr; ptr = ptr->next) diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index c5ed94580..0a0d7549f 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -702,7 +702,7 @@ static char *data_object_to_tempfile(gpgme_data_t data, FILE **ret_fp) static void free_recipient_set(gpgme_key_t **p_rset) { - gpgme_key_t *rset; + gpgme_key_t *rset = NULL; if (!p_rset) return; @@ -3896,7 +3896,7 @@ static char *list_to_pattern(struct ListHead *list) size_t n; n = 0; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, list, entries) { for (s = np->data; *s; s++) @@ -3982,7 +3982,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, unsigned int escaped pappert but simple strings passed in an array to the keylist_ext_start function. */ size_t n = 0; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, hints, entries) { if (np->data && *np->data) diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 223da3a4b..17f16b934 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -366,7 +366,7 @@ pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr, *uids = '\0'; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, hints, entries) { mutt_file_quote_filename(quoted, sizeof(quoted), (char *) np->data); diff --git a/ncrypt/smime.c b/ncrypt/smime.c index 94c922863..6f6befcb2 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1397,7 +1397,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist) char buf[LONG_STRING], certfile[PATH_MAX]; char tempfile[PATH_MAX]; char smimeinfile[PATH_MAX]; - char *cert_start, *cert_end; + char *cert_end = NULL; FILE *smimein = NULL; int err = 0, empty, off; pid_t thepid; @@ -1431,7 +1431,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist) } *certfile = '\0'; - for (cert_start = certlist; cert_start; cert_start = cert_end) + for (char *cert_start = certlist; cert_start; cert_start = cert_end) { cert_end = strchr(cert_start, ' '); if (cert_end) diff --git a/parse.c b/parse.c index 280f2c2fd..585d30d79 100644 --- a/parse.c +++ b/parse.c @@ -1350,7 +1350,7 @@ static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, b return false; } - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, checklist, entries) { a = (struct AttachMatch *) np->data; diff --git a/pattern.c b/pattern.c index 7d5d061b3..da420f571 100644 --- a/pattern.c +++ b/pattern.c @@ -1560,7 +1560,7 @@ static int match_addrlist(struct Pattern *pat, bool match_personal, int n, ...) */ static bool match_reference(struct Pattern *pat, struct ListHead *refs) { - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, refs, entries) { if (patmatch(pat, np->data) == 0) diff --git a/remailer.c b/remailer.c index 5bf5c590d..6b4013690 100644 --- a/remailer.c +++ b/remailer.c @@ -512,7 +512,7 @@ void mix_make_chain(struct ListHead *chainhead) struct MixChain *chain = mutt_mem_calloc(1, sizeof(struct MixChain)); - struct ListNode *p; + struct ListNode *p = NULL; STAILQ_FOREACH(p, chainhead, entries) { mix_chain_add(chain, p->data, type2_list); @@ -764,7 +764,7 @@ int mix_send_message(struct ListHead *chain, const char *tempfile) snprintf(cmd, sizeof(cmd), "cat %s | %s -m ", tempfile, Mixmaster); - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, chain, entries) { mutt_str_strfcpy(tmp, cmd, sizeof(tmp)); diff --git a/rfc2231.c b/rfc2231.c index 17a550251..b945c7377 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -161,7 +161,7 @@ static void rfc2231_join_continuations(struct ParameterList *p, struct Rfc2231Pa mutt_str_strfcpy(attribute, par->attribute, sizeof(attribute)); const bool encoded = par->encoded; - char *valp; + char *valp = NULL; if (encoded) valp = rfc2231_get_charset(par->value, charset, sizeof(charset)); else diff --git a/send.c b/send.c index 403ae4b13..7e83d7393 100644 --- a/send.c +++ b/send.c @@ -349,7 +349,7 @@ static int edit_envelope(struct Envelope *en, int flags) const char *p = NULL; buf[0] = 0; - struct ListNode *uh; + struct ListNode *uh = NULL; STAILQ_FOREACH(uh, &UserHeader, entries) { if (mutt_str_strncasecmp("subject:", uh->data, 8) == 0) @@ -388,7 +388,7 @@ static char *nntp_get_header(const char *s) static void process_user_recips(struct Envelope *env) { - struct ListNode *uh; + struct ListNode *uh = NULL; STAILQ_FOREACH(uh, &UserHeader, entries) { if (mutt_str_strncasecmp("to:", uh->data, 3) == 0) @@ -410,7 +410,7 @@ static void process_user_recips(struct Envelope *env) static void process_user_header(struct Envelope *env) { - struct ListNode *uh; + struct ListNode *uh = NULL; STAILQ_FOREACH(uh, &UserHeader, entries) { if (mutt_str_strncasecmp("from:", uh->data, 5) == 0) @@ -697,8 +697,8 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags) */ static void add_references(struct ListHead *head, struct Envelope *e) { - struct ListHead *src; - struct ListNode *np; + struct ListHead *src = NULL; + struct ListNode *np = NULL; src = !STAILQ_EMPTY(&e->references) ? &e->references : &e->in_reply_to; STAILQ_FOREACH(np, src, entries) diff --git a/sendlib.c b/sendlib.c index c9df37ca6..b312b6a01 100644 --- a/sendlib.c +++ b/sendlib.c @@ -357,7 +357,7 @@ int mutt_write_mime_header(struct Body *a, FILE *f) { size_t len = 25 + mutt_str_strlen(a->subtype); /* approximate len. of content-type */ - struct Parameter *np; + struct Parameter *np = NULL; TAILQ_FOREACH(np, &a->parameter, entries) { char *tmp = NULL; @@ -1758,7 +1758,7 @@ void mutt_write_address_list(struct Address *addr, FILE *fp, int linelen, bool d */ void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim) { - struct ListNode *np; + struct ListNode *np = NULL; size_t length = 0; STAILQ_FOREACH(np, r, entries) @@ -2254,7 +2254,7 @@ int mutt_rfc822_write_header(FILE *fp, struct Envelope *env, } /* Add any user defined headers */ - struct ListNode *tmp; + struct ListNode *tmp = NULL; STAILQ_FOREACH(tmp, &env->userhdrs, entries) { p = strchr(tmp->data, ':'); @@ -2308,7 +2308,7 @@ static void encode_headers(struct ListHead *h) char *p = NULL; int i; - struct ListNode *np; + struct ListNode *np = NULL; STAILQ_FOREACH(np, h, entries) { p = strchr(np->data, ':'); @@ -2851,7 +2851,7 @@ void mutt_prepare_envelope(struct Envelope *env, bool final) */ void mutt_unprepare_envelope(struct Envelope *env) { - struct ListNode *item; + struct ListNode *item = NULL; STAILQ_FOREACH(item, &env->userhdrs, entries) { mutt_rfc2047_decode(&item->data); @@ -3224,7 +3224,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid, if (post && !STAILQ_EMPTY(&hdr->chain)) { fputs("X-Mutt-Mix:", msg->fp); - struct ListNode *p; + struct ListNode *p = NULL; STAILQ_FOREACH(p, &hdr->chain, entries) { fprintf(msg->fp, " %s", (char *) p->data);