Subject: Re: [BUG] git stash show -p with invalid option aborts with double-free in show_stash() (strvec_clear)

From: "Kristoffer Haugsbakk" <[email-masked]>
Date: Fri, 19 Sep 2025 15:11:41 +0200

On Fri, Sep 19, 2025, at 12:18, Lauri Niskanen wrote:
> What did you do before the bug happened?
>
> Create a repo and a stash entry, then invoke `git stash show -p` with
> an invalid option:
>
> git init repro
> cd repro
> touch a
> git add a
> git commit -m init
> echo x >> a
> git stash
> git stash show -p --invalid
>
>
> What did you expect to happen?
>
> Git should print a usage / option error and exit cleanly without crashing.
>
>
> What happened instead?
>
> free(): double free detected in tcache 2

This bisects to 748bd094 (builtin/stash: fix leak in `show_stash()`,
2024-06-11) for me.

> GDB backtrace:
>[snip]

-- 
Kristoffer Haugsbakk