From 16493eb0d0da26f80286b39c7b6900e261744afa Mon Sep 17 00:00:00 2001 From: Tay Ray Chuan Date: Sat, 6 Jun 2009 16:43:26 +0800 Subject: http*: cleanup slot->local after fclose Set slot->local to NULL after doing a fclose() on the file it points to. This prevents the passing of a FILE* pointer to a fclose()'d file to ftell() in http.c::run_active_slot(). This issue was raised by Clemens Buchacher on 30th May 2009: http://www.spinics.net/lists/git/msg104623.html Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- http-walker.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'http-walker.c') diff --git a/http-walker.c b/http-walker.c index c5a3ea3b310..ec1c97f2ee0 100644 --- a/http-walker.c +++ b/http-walker.c @@ -418,15 +418,18 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch run_active_slot(slot); if (results.curl_result != CURLE_OK) { fclose(indexfile); + slot->local = NULL; return error("Unable to get pack index %s\n%s", url, curl_errorstr); } } else { fclose(indexfile); + slot->local = NULL; return error("Unable to start request"); } fclose(indexfile); + slot->local = NULL; return move_temp_to_file(tmpfile, filename); } @@ -776,16 +779,19 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha run_active_slot(slot); if (results.curl_result != CURLE_OK) { fclose(packfile); + slot->local = NULL; return error("Unable to get pack file %s\n%s", url, curl_errorstr); } } else { fclose(packfile); + slot->local = NULL; return error("Unable to start request"); } target->pack_size = ftell(packfile); fclose(packfile); + slot->local = NULL; ret = move_temp_to_file(tmpfile, filename); if (ret) -- cgit v1.2.3