Re: [PATCH 07/20] stash: fix a "struct pathspec" leak
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 29, 2022, 07:02 UTC
- Message-ID
- <xmqq1qoiofoc.fsf@gitster.g>
- In-Reply-To
- <ac9621a0-1046-30de-872f-0171412049bd@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 9 quoted lines
> Am 28.12.22 um 19:00 schrieb Ævar Arnfjörð Bjarmason:
>> Call clear_pathspec() on the pathspec initialized in
>> push_stash().
>
> This puzzled me for a while. This patch adds an {0} initializer to the
> declaration of the pathspec. I assumed that this is necessary to avoid
> giving clear_pathspec() an uninitialized struct. It isn't, though,
> because the pathspec is handed to parse_pathspec() first, which
> initializes it. So you can safely drop the first hunk.It did mislead me too. I expected that addition of "= { 0 }" was to remove memset('\0') somewhere else, but that is not the case.