Skip to content

fix(test): close the RTMP connection in test_rtmp_send_batch (#3401) - #3404

Merged
vpacher merged 1 commit into
masterfrom
fix/3401-rtmp-test-leak
Nov 1, 2026
Merged

vpacher merged 1 commit into
masterfrom
fix/3401-rtmp-test-leak

Conversation

@vpacher

@vpacher vpacher commented Nov 1, 2026

Copy link
Copy Markdown
Member

Fixes #3401. Refs #3375, #3290.

Why

test_rtmp_send_batch leaks the channel packets that RTMP_SendPacket() keeps (4 × 176 bytes): the test calls RTMP_Free() without RTMP_Close(), which frees them. The asan job reports the leak, and with #3290 that report fails the job.

What changes

send_one() calls RTMP_Close() before RTMP_Free(); the socket is already -1, so it sends nothing. Test only; no change to OBS, no assertion changed.

Tests

The test under valgrind (--errors-for-leak-kinds=definite --leak-check=full, the sanitizer harness's flags) in a valgrind build of master:

  • before (RED evidence): exit 99, 512 bytes in 4 blocks definitely lost (176 with the indirect blocks, per case)
  • after: exit 0, 0 bytes definitely lost, 4/4 cases pass

This is a one-line test fix, so RED is the local evidence above, not a separate commit.

Checklist

🤖 Generated with Claude Code

send_one() freed its RTMP with RTMP_Free() only, which leaves the channel
packets RTMP_SendPacket() keeps in m_vecChannelsOut; RTMP_Close() frees
them, as rtmp-stream does when it disconnects. send_one() now calls
RTMP_Close() first; the socket is already -1, so it sends nothing. Test
only, no assertion changed.

Under valgrind (--leak-check=full --errors-for-leak-kinds=definite) in a
valgrind build of master: before, exit 99 with 512 bytes in 4 blocks
definitely lost (176 per case with the indirect block); after, exit 0,
0 bytes lost, 4/4 cases pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=84f23240b76e648daf751deffe44f7b8fa0f66d5 secs=239 lanes=lint:run,rust-test:reused@f6a51ff59ea6,cross:reused@922d0d3a5030,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793525431,"gate":"rust/all/fmt","host":"linux-x86_64","key":"ea9e88fdc44efe3c4a1acebd858c1fde3d1a46a2c0ae40f965384e9fd6eb781b","lane":"lint","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":39,"stamp":"a4d4cabbcff11107330300efa58e236a","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"run"}
Ci-Attestation: {"at":1793525431,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"ea9e88fdc44efe3c4a1acebd858c1fde3d1a46a2c0ae40f965384e9fd6eb781b","lane":"lint","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":39,"stamp":"8bc5fc7fb7344c14af07c343fd639156","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"f6a51ff59ea655cee62299a17270a864c99d2a49b5ff83aa6f33cddff28e31e1","lane":"rust-test","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":null,"stamp":"79762eb4e6a1e77aa39cf055385957a2","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"reused"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":null,"stamp":"5cda0a85fb72f83908ff5cf28308e3ba","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"reused"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":null,"stamp":"d3f11248ab3cb444b5a499b91411fda1","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"reused"}
Ci-Attestation: {"at":1793525191,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":null,"stamp":"5a25c3ef637cb76557399b4c175f2328","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"reused"}
Ci-Attestation: {"at":1793525191,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":null,"stamp":"494c7b239f4fe4865bfcc3070f563dba","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"reused"}
Ci-Attestation: {"at":1793525431,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"6a0084cc175065578c0a4f55a3654be5f527daa422c9d49c3e98a58e1b5818bd","lane":"tier2-linux","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":238,"stamp":"2db0c2b2de5f9c8a9da12450e1b26f45","tree":"84f23240b76e648daf751deffe44f7b8fa0f66d5","v":1,"via":"run"}
@vpacher
vpacher requested a review from zackees November 1, 2026 09:31
@vpacher
vpacher enabled auto-merge November 1, 2026 09:31
@vpacher
vpacher added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit 93b3ec2 Nov 1, 2026
36 checks passed
@vpacher
vpacher deleted the fix/3401-rtmp-test-leak branch November 1, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: test_rtmp_send_batch leaks the RTMP channel packets (LeakSanitizer, valgrind)

1 participant