Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-01 05:10:35 +0300
committerJunio C Hamano <gitster@pobox.com>2022-06-01 05:10:35 +0300
commit4c9b052377453802d0ee1526c865babd7e7368f9 (patch)
tree1d23c2e1693acea158fb116c04c4021af49bcfa9 /http.c
parentdb5b7c3e462a327e07c451d8a6e41b2ba193a1f8 (diff)
parent05e280c0a6d3d5346906c66e3059161bcbcb8889 (diff)
Merge branch 'jc/http-clear-finished-pointer'
Meant to go with js/ci-gcc-12-fixes. * jc/http-clear-finished-pointer: http.c: clear the 'finished' member once we are done with it
Diffstat (limited to 'http.c')
-rw-r--r--http.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/http.c b/http.c
index f7d53a0a25..68573b6da5 100644
--- a/http.c
+++ b/http.c
@@ -1385,6 +1385,32 @@ void run_active_slot(struct active_request_slot *slot)
select(max_fd+1, &readfds, &writefds, &excfds, &select_timeout);
}
}
+
+ /*
+ * The value of slot->finished we set before the loop was used
+ * to set our "finished" variable when our request completed.
+ *
+ * 1. The slot may not have been reused for another requst
+ * yet, in which case it still has &finished.
+ *
+ * 2. The slot may already be in-use to serve another request,
+ * which can further be divided into two cases:
+ *
+ * (a) If call run_active_slot() hasn't been called for that
+ * other request, slot->finished would have been cleared
+ * by get_active_slot() and has NULL.
+ *
+ * (b) If the request did call run_active_slot(), then the
+ * call would have updated slot->finished at the beginning
+ * of this function, and with the clearing of the member
+ * below, we would find that slot->finished is now NULL.
+ *
+ * In all cases, slot->finished has no useful information to
+ * anybody at this point. Some compilers warn us for
+ * attempting to smuggle a pointer that is about to become
+ * invalid, i.e. &finished. We clear it here to assure them.
+ */
+ slot->finished = NULL;
}
static void release_active_slot(struct active_request_slot *slot)