diff options
author | Martin Ågren <martin.agren@gmail.com> | 2020-08-10 21:47:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-08-10 14:59:57 -0700 |
commit | ac900fddb7fd3cc760ea5c1b79a50ad4564e4a0d (patch) | |
tree | de9480180f8ff9baf60942dd020c2e54e62371b3 /t/t3426-rebase-submodule.sh | |
parent | trace2: log progress time and throughput (diff) | |
download | tgif-ac900fddb7fd3cc760ea5c1b79a50ad4564e4a0d.tar.xz |
progress: don't dereference before checking for NULL
In `stop_progress()`, we're careful to check that `p_progress` is
non-NULL before we dereference it, but by then we have already
dereferenced it when calling `finish_if_sparse(*p_progress)`. And, for
what it's worth, we'll go on to blindly dereference it again inside
`stop_progress_msg()`.
We could return early if we get a NULL-pointer, but let's go one step
further and BUG instead. The progress API handles NULL just fine, but
that's the NULL-ness of `*p_progress`, e.g., when running with
`--no-progress`. If `p_progress` is NULL, chances are that's a mistake.
For symmetry, let's do the same check in `stop_progress_msg()`, too.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3426-rebase-submodule.sh')
0 files changed, 0 insertions, 0 deletions