Subject: Re: [PATCH] 2.36 gitk/diff-tree --stdin regression fix

From: Junio C Hamano <[email-masked]>
Date: Tue, 26 Apr 2022 08:26:50 -0700

I wonder if we would have caught a regression like the one if we
used FREE_AND_NULL more sparingly.  For example, if we prematurely
called clear_pathspec(), the second iteration, because there is
free-and-null of pathspec->items and resetting pathspec->nr to 0,
would behave very normally as if there is no pathspec.  If we just
freed things, without NULLing them out or resetting .nr to 0, the
second iteration would try to access garbage and hopefully we will
catch a crash before such a code would have escaped the lab.

In any case, based on what I heard here, it appears that mimicking
"git log" does may probably be a better way to deal with this
regression?  As you said, all the other things diff_free() calls are
unwanted while "diff-tree --stdin" is still working, just like
"log"?

Thanks.