Skip to content

Commit

Permalink
upload-pack: do not check NULL return of lookup_unknown_object
Browse files Browse the repository at this point in the history
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 13, 2015
1 parent e172755 commit 8ddf3ca
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,6 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1)
o->flags |= HIDDEN_REF;
return 1;
}
if (!o)
die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
o->flags |= OUR_REF;
return 0;
}
Expand Down

0 comments on commit 8ddf3ca

Please sign in to comment.