Re: [PATCH v9 4/4] hook: introduce the receive-report hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 10, 2026, 03:15 UTC
- Message-ID
- <xmqqjyotokyg.fsf@gitster.g>
- In-Reply-To
- <20260909-758-introduce-hook-v9-4-3043d417e0ee@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 5 quoted lines
> +static void override_cmds_error(struct command *commands, const char *err)
> +{
> + for (struct command *cmd = commands; cmd; cmd = cmd->next)
> + cmd->error_string = err;
> +}Doesn't this leak existing cmd->error_string if it is owned? In other words, something like
for (struct command *cmd = commands; cmd; cmd = cmd->next) {
if (cmd->error_string_owned)
FREE_AND_NULL(cmd->error_string_owned);
cmd->error_string = err;
}is in order, perhaps?