From: Eric Sunshine Date: Fri, 01 May 2015 19:41:22 GMT Subject: Re: [PATCH] checkout-index.c: Unconditionally free memory Message-ID: In-Reply-To: On Fri, May 1, 2015 at 3:33 PM, Eric Sunshine wrote: > On Fri, May 1, 2015 at 3:28 PM, Stefan Beller wrote: >> It's safe to free the char pointer `p` unconditionally. >> >> The pointer is assigned just 2 lines earlier as a return from >> prefix_path, which allocates new memory for its return value. >> >> Then it is used in checkout_file, which passes the pointer on to >> cache_name_pos and write_tempfile_record, both of which do not store >> the pointer in any permanent record. >> >> So the condition on when to free the pointer is just "always". > > Why doesn't the 'p' in the 'while' loop just below deserve the same treatment? Ditto update-index.c:do_unresolved().