Permalink
Browse files

notmuch: don't use uninitialized HEADER in nm_check_database()

Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information...
1 parent b1e72d4 commit ad75d0518988a547aacdb6bee0b7b8c5f52882b2 @karelzak committed Apr 16, 2012
Showing with 10 additions and 7 deletions.
  1. +10 −7 mutt_notmuch.c
View
17 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)

0 comments on commit ad75d05

Please sign in to comment.