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>

Stefan Naewe committed Dec 5, 2015 at 16:27 UTC a2678df335f3404bc5d96683fa36b8cfab7946b0
1 file changed +3 -1
revision.c
+3 -1
@@ -131,10 +131,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
131
132 void mark_tree_uninteresting(struct tree *tree)
133 {
134 - struct object *obj = &tree->object;
134 + struct object *obj;
135
136 if (!tree)
137 return;
138 +
139 + obj = &tree->object;
140 if (obj->flags & UNINTERESTING)
141 return;
142 obj->flags |= UNINTERESTING;