Skip to content

Commit be273c7

Browse files
committed
Merge branch 'rc/maint-http-local-slot-fix' into maint
* rc/maint-http-local-slot-fix: http*: cleanup slot->local after fclose
2 parents d836118 + 16493eb commit be273c7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

http-push.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,11 @@ static void finish_request(struct transfer_request *request)
724724
struct stat st;
725725
struct packed_git *target;
726726
struct packed_git **lst;
727+
struct active_request_slot *slot;
727728

728729
request->curl_result = request->slot->curl_result;
729730
request->http_code = request->slot->http_code;
731+
slot = request->slot;
730732
request->slot = NULL;
731733

732734
/* Keep locks active */
@@ -823,6 +825,7 @@ static void finish_request(struct transfer_request *request)
823825

824826
fclose(request->local_stream);
825827
request->local_stream = NULL;
828+
slot->local = NULL;
826829
if (!move_temp_to_file(request->tmpfile,
827830
request->filename)) {
828831
target = (struct packed_git *)request->userData;
@@ -1024,17 +1027,20 @@ static int fetch_index(unsigned char *sha1)
10241027
if (results.curl_result != CURLE_OK) {
10251028
free(url);
10261029
fclose(indexfile);
1030+
slot->local = NULL;
10271031
return error("Unable to get pack index %s\n%s", url,
10281032
curl_errorstr);
10291033
}
10301034
} else {
10311035
free(url);
10321036
fclose(indexfile);
1037+
slot->local = NULL;
10331038
return error("Unable to start request");
10341039
}
10351040

10361041
free(url);
10371042
fclose(indexfile);
1043+
slot->local = NULL;
10381044

10391045
return move_temp_to_file(tmpfile, filename);
10401046
}

http-walker.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,15 +418,18 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
418418
run_active_slot(slot);
419419
if (results.curl_result != CURLE_OK) {
420420
fclose(indexfile);
421+
slot->local = NULL;
421422
return error("Unable to get pack index %s\n%s", url,
422423
curl_errorstr);
423424
}
424425
} else {
425426
fclose(indexfile);
427+
slot->local = NULL;
426428
return error("Unable to start request");
427429
}
428430

429431
fclose(indexfile);
432+
slot->local = NULL;
430433

431434
return move_temp_to_file(tmpfile, filename);
432435
}
@@ -776,16 +779,19 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
776779
run_active_slot(slot);
777780
if (results.curl_result != CURLE_OK) {
778781
fclose(packfile);
782+
slot->local = NULL;
779783
return error("Unable to get pack file %s\n%s", url,
780784
curl_errorstr);
781785
}
782786
} else {
783787
fclose(packfile);
788+
slot->local = NULL;
784789
return error("Unable to start request");
785790
}
786791

787792
target->pack_size = ftell(packfile);
788793
fclose(packfile);
794+
slot->local = NULL;
789795

790796
ret = move_temp_to_file(tmpfile, filename);
791797
if (ret)

0 commit comments

Comments
 (0)