From: Jeff King Date: Fri, 13 Mar 2015 04:42:25 +0000 (-0400) Subject: upload-pack: do not check NULL return of lookup_unknown_object X-Git-Tag: v2.4.0-rc0~25^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ddf3ca74f40bebd79cedba5ba82ca9f2eb33860;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/upload-pack.c b/upload-pack.c index af2a13acc6..4bc2dc3607 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -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; }