From a2678df335f3404bc5d96683fa36b8cfab7946b0 Mon Sep 17 00:00:00 2001 From: Stefan Naewe Date: Sat, 5 Dec 2015 16:27:24 +0100 Subject: 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 Signed-off-by: Junio C Hamano --- revision.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/revision.c b/revision.c index 9b9d77dc43..7f4acad456 100644 --- a/revision.c +++ b/revision.c @@ -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; -- cgit v1.2.3