On Tue, Sep 06, 2011 at 12:58:16PM -0700, Junio C Hamano wrote: > Junio C Hamano <gitster@xxxxxxxxx> writes: > > > Is it because we no longer ever return "prefix" we pass in which is a > > pointer to a constant memory region to begin with? > > > > We also didn't free() in the earlier code (because we do not know if it > > can be freed) and leaking xmemdupz() if the function didn't return the > > "prefix", but now you plugged the small leak. Isn't it something you > > should advertise? > > Nah, the leak is not necessarily plugged in all callers anyway, so scratch > that part. I've rewritten it like this: Ok. The only other caller, though, is cmd_ls_files(). And it would be trivial to plug that leak as well. But is it considered a leak, if the program is going to terminate right after the function returns? I recall that being used as an argument against free'ing such memory on this list. On the other hand, that practice makes it harder to analyze leaks using memory leak detectors like for example valgrind. Clemens -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html