Skip to content

Commit a2678df

Browse files
snaewegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2435856 commit a2678df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

revision.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
131131

132132
void mark_tree_uninteresting(struct tree *tree)
133133
{
134-
struct object *obj = &tree->object;
134+
struct object *obj;
135135

136136
if (!tree)
137137
return;
138+
139+
obj = &tree->object;
138140
if (obj->flags & UNINTERESTING)
139141
return;
140142
obj->flags |= UNINTERESTING;

0 commit comments

Comments
 (0)