commit-reach: avoid NULL dereference
commitc5773dc078f05a98c9359938dbce3b3dc70aa3bd
authorEric Wong <e@80x24.org>
Sat, 11 Feb 2023 11:15:26 +0000 (11 11:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Feb 2023 19:36:24 +0000 (11 11:36 -0800)
tree6e016ecf74b3ef7bb22ce24fc08f20abecb42637
parent4067a64672f9db8ca38d5a2682a7cdba7938c18b
commit-reach: avoid NULL dereference

The loop at the top of can_all_from_reach_with_flag() already
accounts for `from->objects[i].item' being NULL, so it follows
the cleanup loop should also account for a NULL `from_one'.

I managed to segfault here on one of my giant, many-remote repos
using `git fetch --negotiation-tip=...  --negotiation-only'
where the --negotiation-tip= argument was a glob which (inadvertently)
captured more refs than I wanted.  I have not reproduced this
in a standalone test case.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit-reach.c