From: Johannes Schindelin Date: Sat, 12 Jan 2008 16:57:49 GMT Subject: Re: [ANNOUNCE] GIT 1.5.4-rc3 Message-ID: In-Reply-To: <20080112090432.GA6134@coredump.intra.peff.net> Hi, On Sat, 12 Jan 2008, Jeff King wrote: > diff --git a/builtin-clean.c b/builtin-clean.c > index 6cad8ea..eb853a3 100644 > --- a/builtin-clean.c > +++ b/builtin-clean.c > @@ -90,7 +90,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) > 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]; > @@ -125,7 +125,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) > 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 { Would it not be better to guard the memset by an "if (argc)", and set "seen" to NULL by default? Ciao, Dscho