aboutsummaryrefslogtreecommitdiffstats
path: root/http-push.c
diff options
context:
space:
mode:
authorTay Ray Chuan <rctay89@gmail.com>2009-06-06 16:43:26 +0800
committerJunio C Hamano <gitster@pobox.com>2009-06-06 10:30:16 -0700
commit16493eb0d0da26f80286b39c7b6900e261744afa (patch)
tree0bb792b08d7d27741aa2c2f4d5dc5fc97117ce26 /http-push.c
parentb74fce16fa51362d4a3875d46e488006c3ad5371 (diff)
downloadgit-16493eb0d0da26f80286b39c7b6900e261744afa.tar.gz
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 <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r--http-push.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/http-push.c b/http-push.c
index 5138224cc3..673a61110e 100644
--- a/http-push.c
+++ b/http-push.c
@@ -724,9 +724,11 @@ static void finish_request(struct transfer_request *request)
struct stat st;
struct packed_git *target;
struct packed_git **lst;
+ struct active_request_slot *slot;
request->curl_result = request->slot->curl_result;
request->http_code = request->slot->http_code;
+ slot = request->slot;
request->slot = NULL;
/* Keep locks active */
@@ -823,6 +825,7 @@ static void finish_request(struct transfer_request *request)
fclose(request->local_stream);
request->local_stream = NULL;
+ slot->local = NULL;
if (!move_temp_to_file(request->tmpfile,
request->filename)) {
target = (struct packed_git *)request->userData;
@@ -1024,17 +1027,20 @@ static int fetch_index(unsigned char *sha1)
if (results.curl_result != CURLE_OK) {
free(url);
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to get pack index %s\n%s", url,
curl_errorstr);
}
} else {
free(url);
fclose(indexfile);
+ slot->local = NULL;
return error("Unable to start request");
}
free(url);
fclose(indexfile);
+ slot->local = NULL;
return move_temp_to_file(tmpfile, filename);
}