Browse Source

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>
maint
Stefan Naewe 9 years ago committed by Junio C Hamano
parent
commit
a2678df335
  1. 4
      revision.c

4
revision.c

@ -131,10 +131,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree) @@ -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…
Cancel
Save