Skip to content

Commit 782ca8c

Browse files
committed
Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting'
mark_tree_uninteresting() has code to handle the case where it gets passed a NULL pointer in its 'tree' parameter, but the function had 'object = &tree->object' assignment before checking if tree is NULL. This gives a compiler an excuse to declare that tree will never be NULL and apply a wrong optimization. Avoid it. * sn/null-pointer-arith-in-mark-tree-uninteresting: revision.c: fix possible null pointer arithmetic
2 parents fa41b05 + a2678df commit 782ca8c

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
@@ -135,10 +135,12 @@ static void mark_tree_contents_uninteresting(struct tree *tree)
135135

136136
void mark_tree_uninteresting(struct tree *tree)
137137
{
138-
struct object *obj = &tree->object;
138+
struct object *obj;
139139

140140
if (!tree)
141141
return;
142+
143+
obj = &tree->object;
142144
if (obj->flags & UNINTERESTING)
143145
return;
144146
obj->flags |= UNINTERESTING;

0 commit comments

Comments
 (0)