sequencer: introduce todo_list_write_to_file()
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index 47c2fca8dc33970a1f4f041360ef954da6fa75a8..ab6477d777e96cb9789f1c6b3220af349731a701 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -281,8 +281,15 @@ static int match_attrs(const struct index_state *istate,
                       const struct pathspec_item *item)
 {
        int i;
+       char *to_free = NULL;
+
+       if (name[namelen])
+               name = to_free = xmemdupz(name, namelen);
 
        git_check_attr(istate, name, item->attr_check);
+
+       free(to_free);
+
        for (i = 0; i < item->attr_match_nr; i++) {
                const char *value;
                int matched;