Merge branch 'sk/wincred'
[gitweb.git] / builtin / rm.c
index 05642184c5d89addae1900660ad99e5f29c324f2..960634dd0c52f1da689e8a54980e5e81cf2d2f36 100644 (file)
@@ -311,7 +311,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                if (!ce_path_match(ce, &pathspec, seen))
                        continue;
                ALLOC_GROW(list.entry, list.nr + 1, list.alloc);
-               list.entry[list.nr].name = ce->name;
+               list.entry[list.nr].name = xstrdup(ce->name);
                list.entry[list.nr].is_submodule = S_ISGITLINK(ce->ce_mode);
                if (list.entry[list.nr++].is_submodule &&
                    !is_staging_gitmodules_ok())