From: Johannes Schindelin Date: Sat, 17 Jan 2009 05:40:21 GMT Subject: Re: [PATCH/RFC v3 2/6] reflog: refactor log open+mmap Message-ID: In-Reply-To: <1232163011-20088-3-git-send-email-trast@student.ethz.ch> Hi, On Sat, 17 Jan 2009, Thomas Rast wrote: > +static char *open_reflog(const char *ref, size_t *mapsz, const char **logfile) > +{ > + struct stat st; > + int logfd; > + char *map; > + > + *logfile = git_path("logs/%s", ref); That is dangerous. git_path() returns a pointer to a static buffer. Before your patch, logfile was a local variable, and one could be relatively sure that git_path() was not called during the lifetime. Now the lifetime of logfile is no longer as clear-cut, and it is much easier to overlook that git_path() must not be called while logfile holds a reference to its static buffer. Ciao, Dscho