summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 98fa5b6)
raw | patch | inline | side by side (parent: 98fa5b6)
author | Jeff King <peff@peff.net> | |
Sat, 12 Jan 2008 09:04:32 +0000 (04:04 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 12 Jan 2008 19:10:09 +0000 (11:10 -0800) |
The "seen" variable is used by match_pathspec, and must have
as many elements as there are in the given pathspec. We
create the pathspec either from the command line arguments
_or_ from just the current prefix.
Thus allocating "seen" based upon just argc is wrong, since
if argc == 0, then we still have one pathspec, the prefix,
but we don't allocate any space in "seen".
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: İsmail Dönmez <ismail@pardus.org.tr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
as many elements as there are in the given pathspec. We
create the pathspec either from the command line arguments
_or_ from just the current prefix.
Thus allocating "seen" based upon just argc is wrong, since
if argc == 0, then we still have one pathspec, the prefix,
but we don't allocate any space in "seen".
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: İsmail Dönmez <ismail@pardus.org.tr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-clean.c | patch | blob | history |
diff --git a/builtin-clean.c b/builtin-clean.c
index 6cad8eaf2591c8f7f04c78f5a2162808ae702e25..eb853a37cf993a875f2acd1992ee5191783740a1 100644 (file)
--- a/builtin-clean.c
+++ b/builtin-clean.c
strbuf_init(&directory, 0);
if (pathspec)
- seen = xmalloc(argc);
+ seen = xmalloc(argc > 0 ? argc : 1);
for (i = 0; i < dir.nr; i++) {
struct dir_entry *ent = dir.entries[i];
continue;
if (pathspec) {
- memset(seen, 0, argc);
+ memset(seen, 0, argc > 0 ? argc : 1);
matches = match_pathspec(pathspec, ent->name, ent->len,
baselen, seen);
} else {