Re: [PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-23 Thread Eric Sunshine
On Wed, Jun 18, 2014 at 4:36 PM, Jeff King p...@peff.net wrote: When we get the author name and email either from an existing commit or from the --author option, we create a copy of the strings. We cannot just free() these copies, since the same pointers may also be pointing to getenv()

Re: [PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-23 Thread Erik Faye-Lund
On Mon, Jun 23, 2014 at 11:28 AM, Eric Sunshine sunsh...@sunshineco.com wrote: On Wed, Jun 18, 2014 at 4:36 PM, Jeff King p...@peff.net wrote: When we get the author name and email either from an existing commit or from the --author option, we create a copy of the strings. We cannot just

Re: [PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-23 Thread Eric Sunshine
On Mon, Jun 23, 2014 at 5:33 AM, Erik Faye-Lund kusmab...@gmail.com wrote: On Mon, Jun 23, 2014 at 11:28 AM, Eric Sunshine sunsh...@sunshineco.com wrote: On Wed, Jun 18, 2014 at 4:36 PM, Jeff King p...@peff.net wrote: When we get the author name and email either from an existing commit or

Re: [PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-23 Thread Jeff King
On Mon, Jun 23, 2014 at 05:28:14AM -0400, Eric Sunshine wrote: static void determine_author_info(struct strbuf *author_ident) { char *name, *email, *date; struct ident_split author; - struct strbuf date_buf = STRBUF_INIT; + struct strbuf name_buf =

Re: [PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-23 Thread Jeff King
On Mon, Jun 23, 2014 at 11:33:56AM +0200, Erik Faye-Lund wrote: This approach has the added benefit of fixing the case where getenv uses a static buffer, like POSIX allows. Good point. I knew we could invalidate the pointer if setenv() was called, but I didn't know that another getenv() could

[PATCH 7/7] determine_author_info: stop leaking name/email

2014-06-18 Thread Jeff King
When we get the author name and email either from an existing commit or from the --author option, we create a copy of the strings. We cannot just free() these copies, since the same pointers may also be pointing to getenv() storage which we do not own. Instead, let's treat these the same way as