]> git.ipfire.org Git - thirdparty/git.git/blobdiff - http.c
Sync with 2.34.8
[thirdparty/git.git] / http.c
diff --git a/http.c b/http.c
index 2a97d1773557710a1ebb8ac02ed72c2fc52d318d..bb8d8907120ebe8fb283f821f5dc8fa8713c6d96 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1398,6 +1398,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)