From e87d66a90a672916b39e7a6f33fe2dbedd1aecbf Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 16 Apr 2012 09:30:43 +0200 Subject: [PATCH] don't use uninitialized HEADER in nm_check_database() Signed-off-by: Karel Zak --- mutt_notmuch.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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) -- 2.49.0