]> granicus.if.org Git - neomutt/commitdiff
don't use uninitialized HEADER in nm_check_database()
authorKarel Zak <kzak@redhat.com>
Mon, 16 Apr 2012 07:30:43 +0000 (09:30 +0200)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 15:30:05 +0000 (16:30 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
mutt_notmuch.c

index e6476731d168d3f79efb83949516a1829bff9957..e75b734705309010d0a4dcbe4d47b8f45887def1 100644 (file)
@@ -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)