http-fetch: fix possible segfault
authorNick Hengeveld <nickh@reactrix.com>
Wed, 7 Jun 2006 05:22:35 +0000 (22:22 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 7 Jun 2006 05:32:51 +0000 (22:32 -0700)
Initialize an object request's slot to a safe value.  A non-NULL value
can cause a segfault if the request is aborted before it starts.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http-fetch.c

index 661c909..d3602b7 100644 (file)
@@ -399,6 +399,7 @@ void prefetch(unsigned char *sha1)
        snprintf(newreq->filename, sizeof(newreq->filename), "%s", filename);
        snprintf(newreq->tmpfile, sizeof(newreq->tmpfile),
                 "%s.temp", filename);
+       newreq->slot = NULL;
        newreq->next = NULL;
 
        if (object_queue_head == NULL) {