From: Karel Zak Date: Mon, 16 Apr 2012 07:30:43 +0000 (+0200) Subject: don't use uninitialized HEADER in nm_check_database() X-Git-Tag: neomutt-20160404~13^2~66 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1145dd9f8c6af3e1ee74c40968851c355a7f2485;p=neomutt don't use uninitialized HEADER in nm_check_database() Signed-off-by: Karel Zak --- diff --git a/mutt_notmuch.c b/mutt_notmuch.c index e6476731d..e75b73470 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -1131,15 +1131,18 @@ int nm_check_database(CONTEXT *ctx, int *index_hint) new = notmuch_message_get_filename(m); nm_header_get_fullpath(h, old, sizeof(old)); - if (mutt_strcmp(old, new)) { - HEADER tmp; - + if (mutt_strcmp(old, new) != 0) update_message_path(h, new); - if (!h->changed) { - maildir_parse_flags(&tmp, new); - maildir_update_flags(ctx, h, &tmp); - } + if (!h->changed) { + /* if the user hasn't modified the flags on + * this message, update the flags we just + * detected. + */ + HEADER tmp; + memset(&tmp, 0, sizeof(tmp)); + maildir_parse_flags(&tmp, new); + maildir_update_flags(ctx, h, &tmp); } if (update_message_tags(h, m) == 0)