diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-12-11 20:14:38 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-12-11 20:14:38 +0100 |
commit | 58e3dd21f68c5eec945e7ddd4690733bd0103ce5 (patch) | |
tree | 2f68876b8a17df7a81115112d5762d6282b985dc /revision.c | |
parent | Merge branch 'sg/lock-file-commit-error' into maint (diff) | |
parent | revision.c: fix possible null pointer arithmetic (diff) | |
download | git-58e3dd21f68c5eec945e7ddd4690733bd0103ce5.tar.xz git-58e3dd21f68c5eec945e7ddd4690733bd0103ce5.zip |
Merge branch 'sn/null-pointer-arith-in-mark-tree-uninteresting' into maint
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
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/revision.c b/revision.c index 351fb5b9f1..f6caef0672 100644 --- a/revision.c +++ b/revision.c @@ -135,10 +135,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; |