mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
commit-reach: fix cast in compare_commits_by_gen()
The elements of the array to be sorted are commit pointers, so the comparison function gets handed references to these pointers, not pointers to commit objects. Cast to the right type and dereference once to correctly get the commit reference. Found using Clang's ASan and t5500. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4067a64672
commit
8628ace269
@ -526,8 +526,8 @@ int commit_contains(struct ref_filter *filter, struct commit *commit,
|
||||
|
||||
static int compare_commits_by_gen(const void *_a, const void *_b)
|
||||
{
|
||||
const struct commit *a = (const struct commit *)_a;
|
||||
const struct commit *b = (const struct commit *)_b;
|
||||
const struct commit *a = *(const struct commit * const *)_a;
|
||||
const struct commit *b = *(const struct commit * const *)_b;
|
||||
|
||||
if (a->generation < b->generation)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user