Skip to content

Commit

Permalink
http.c: Drop useless != NULL test in finish_http_pack_request
Browse files Browse the repository at this point in the history
The test preq->packfile != NULL is always true.  If packfile was
actually NULL when entering this function the ftell() above would
crash out with a SIGSEGV, resulting in never reaching this point.

Simplify the code by just removing the conditional.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Apr 17, 2010
1 parent 021ab6f commit 3065274
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,9 @@ int finish_http_pack_request(struct http_pack_request *preq)
struct packed_git *p = preq->target;

p->pack_size = ftell(preq->packfile);

if (preq->packfile != NULL) {
fclose(preq->packfile);
preq->packfile = NULL;
preq->slot->local = NULL;
}
fclose(preq->packfile);
preq->packfile = NULL;
preq->slot->local = NULL;

lst = preq->lst;
while (*lst != p)
Expand Down

0 comments on commit 3065274

Please sign in to comment.