summaryrefslogtreecommitdiff
path: root/COPYING
diff options
context:
space:
mode:
authorMartin Ågren <martin.agren@gmail.com>2017-11-05 21:24:30 +0100
committerJunio C Hamano <gitster@pobox.com>2017-11-06 10:15:29 +0900
commit7c117184d7e3727d4240beb42148d106483d00b9 (patch)
treec76552523fce10e1df25b7a6762f0b34e6d2cc76 /COPYING
parentfc5c40bb2bb1921f3bdfa55c1d846dc080c356b2 (diff)
downloadgit-7c117184d7e3727d4240beb42148d106483d00b9.tar.gz
bisect: fix off-by-one error in `best_bisection_sorted()`
After we have sorted the `cnt`-many commits that we have selected, we place them into the commit list. We then set `p->next` to NULL, but as we do so, `p` is already pointing one beyond item number `cnt`. Indeed, we check whether `p` is NULL before dereferencing it. This only matters if there are TREESAME-commits. Since they should be skipped, they are not included in `cnt` and we will hit the situation where we set `p->next` to NULL. As a result, the list will be one longer than it should be. The last commit in the list will be one which occurs earlier, or which shouldn't be included. Do not update `p` the very last round in the loop. This ensures that after the loop, `p->next` points to the remainder of the list, and we can set it to NULL. While we're here, free that remainder to fix a memory leak. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions