Skip to content

Commit 8ddf3ca

Browse files
peffgitster
authored andcommitted
upload-pack: do not check NULL return of lookup_unknown_object
We check whether the return value of lookup_unknown_object is NULL, but some code paths dereference it before our check. This turns out not to be capable of causing a segfault, though. The lookup_unknown_object function will never return NULL, since the whole point is to allocate an object struct if it does not find an existing one. So the code here is not wrong, it is just confusing. Let's just drop the NULL check. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e172755 commit 8ddf3ca

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

upload-pack.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,6 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1)
688688
o->flags |= HIDDEN_REF;
689689
return 1;
690690
}
691-
if (!o)
692-
die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
693691
o->flags |= OUR_REF;
694692
return 0;
695693
}

0 commit comments

Comments
 (0)