revision.c: fix possible null pointer arithmetic
mark_tree_uninteresting() dereferences a tree pointer before checking if the pointer is valid. Fix that by doing the check first. Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
24358560c3
commit
a2678df335
@ -131,10 +131,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
|
||||
|
||||
void mark_tree_uninteresting(struct tree *tree)
|
||||
{
|
||||
struct object *obj = &tree->object;
|
||||
struct object *obj;
|
||||
|
||||
if (!tree)
|
||||
return;
|
||||
|
||||
obj = &tree->object;
|
||||
if (obj->flags & UNINTERESTING)
|
||||
return;
|
||||
obj->flags |= UNINTERESTING;
|
||||
|
Loading…
Reference in New Issue
Block a user