Skip to content

Commit 618f5d8

Browse files
committed
make sure the lifetime
1 parent b389b28 commit 618f5d8

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_stream_manager.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,12 @@ TEST_CASE(h2_sm_mock_cancel_after_goaway_no_double_complete) {
11941194
* and the cancel cross-thread task will run, causing double on_complete. */
11951195
aws_http_stream_cancel_default_error(stream);
11961196

1197-
/* Drain tasks - this should NOT crash from double stream completion */
1197+
/* User releases their ref on the stream (simulates real usage: cancel then release).
1198+
* The stream must stay alive until the cross-thread task completes. */
1199+
aws_http_stream_release(stream);
1200+
aws_array_list_clear(&s_tester.streams);
1201+
1202+
/* Drain tasks - this should NOT crash from double stream completion or use-after-free */
11981203
testing_channel_drain_queued_tasks(&fake_connection->testing_channel);
11991204

12001205
/* Stream should be completed with error at least once */

0 commit comments

Comments
 (0)