Skip to content

Commit 0737200

Browse files
gitsterdscho
authored andcommitted
Merge branch 'backport/jc/http-clear-finished-pointer' into maint-2.30
Meant to go with js/ci-gcc-12-fixes. source: <[email protected]> * jc/http-clear-finished-pointer: http.c: clear the 'finished' member once we are done with it
2 parents 0a1dc55 + 5843080 commit 0737200

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

http.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,32 @@ void run_active_slot(struct active_request_slot *slot)
15231523
finish_active_slot(slot);
15241524
}
15251525
#endif
1526+
1527+
/*
1528+
* The value of slot->finished we set before the loop was used
1529+
* to set our "finished" variable when our request completed.
1530+
*
1531+
* 1. The slot may not have been reused for another requst
1532+
* yet, in which case it still has &finished.
1533+
*
1534+
* 2. The slot may already be in-use to serve another request,
1535+
* which can further be divided into two cases:
1536+
*
1537+
* (a) If call run_active_slot() hasn't been called for that
1538+
* other request, slot->finished would have been cleared
1539+
* by get_active_slot() and has NULL.
1540+
*
1541+
* (b) If the request did call run_active_slot(), then the
1542+
* call would have updated slot->finished at the beginning
1543+
* of this function, and with the clearing of the member
1544+
* below, we would find that slot->finished is now NULL.
1545+
*
1546+
* In all cases, slot->finished has no useful information to
1547+
* anybody at this point. Some compilers warn us for
1548+
* attempting to smuggle a pointer that is about to become
1549+
* invalid, i.e. &finished. We clear it here to assure them.
1550+
*/
1551+
slot->finished = NULL;
15261552
}
15271553

15281554
static void release_active_slot(struct active_request_slot *slot)

0 commit comments

Comments
 (0)