Code

http-push: do not SEGV after fetching a bad pack idx file
authorTay Ray Chuan <rctay89@gmail.com>
Sat, 6 Jun 2009 08:43:37 +0000 (16:43 +0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Jun 2009 17:56:27 +0000 (10:56 -0700)
In a70c232 ("http-fetch: do not SEGV after fetching a bad pack idx
file"), changes were made to the setup_index method in http-fetch.c
(known in its present form as http-walker.c after 30ae764 ("Modularize
commit-walker")). Since http-push.c has similar similar code for
processing index files, these changes should apply to http-push.c's
implementation of setup_index as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c

index 82018009f3fd52ac207aa0da29376c7dde80e798..281e153eb3655d0aa2b94d62a292672ae6ef768e 100644 (file)
@@ -1065,6 +1065,8 @@ static int setup_index(unsigned char *sha1)
                return -1;
 
        new_pack = parse_pack_index(sha1);
+       if (!new_pack)
+               return -1; /* parse_pack_index() already issued error message */
        new_pack->next = repo->packs;
        repo->packs = new_pack;
        return 0;