Skip to content

fix(test): free the packet buffer in test_ffmpeg_mux_write_packet (#3400) - #3403

Merged
vpacher merged 1 commit into
masterfrom
fix/3400-mux-test-leak
Nov 1, 2026
Merged

vpacher merged 1 commit into
masterfrom
fix/3400-mux-test-leak

Conversation

@vpacher

@vpacher vpacher commented Nov 1, 2026

Copy link
Copy Markdown
Member

Fixes #3400. Refs #3361, #3290.

Why

test_ffmpeg_mux_write_packet leaks stream.packet_buf (66,064 bytes): its stream never goes through ffmpeg_mux_destroy(), which frees the buffer. The asan job reports the leak, and with #3290 that report fails the job.

What changes

run() frees stream.packet_buf after its checks. 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, 66,064 bytes in 2 blocks definitely lost
  • after: exit 0, 0 bytes definitely lost, 3/3 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

)

The test's stream never goes through ffmpeg_mux_destroy(), which frees
stream->packet_buf, so each case leaked the 64 KiB buffer write_packet()
keeps there. run() now frees it after its checks. 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 66,064 bytes in 2 blocks
definitely lost; after, exit 0, 0 bytes lost, 3/3 cases pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=877c9847704ef19cb69720bf09423afd2cce3434 secs=242 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1793525191,"gate":"rust/all/fmt","host":"linux-x86_64","key":"1673276b7f97a9f7a84efb3847a994e3fe847ca3ea070e7cf02b085b32066612","lane":"lint","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":39,"stamp":"745cabcb327d08db18b16d88778e181e","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"1673276b7f97a9f7a84efb3847a994e3fe847ca3ea070e7cf02b085b32066612","lane":"lint","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":39,"stamp":"5920e26dcb6906ad6b517bdb6dba5bc4","tree":"877c9847704ef19cb69720bf09423afd2cce3434","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":83,"stamp":"6410112b3a5abce9ed3099e339f42f5f","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":24,"stamp":"a7e0277862e60d3ca70fcaae7299ef04","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":24,"stamp":"3a1b23d26421c8265e6e3a4f234dd3a1","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":24,"stamp":"9834d7c580f843e03fb7b084d4d26db2","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"922d0d3a50308d6bf15bbae51960b31b237342437e9b096ee35f3b164605a246","lane":"cross","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":24,"stamp":"dfd18553fdce630623b9f413bb7863bf","tree":"877c9847704ef19cb69720bf09423afd2cce3434","v":1,"via":"run"}
Ci-Attestation: {"at":1793525191,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"07ee8b25327b97fdf8242b9a2b3cd3895c01593c51bb0a494a8a7119ed194241","lane":"tier2-linux","parents":["44c1d782f649db2fb01b632efed1cfd1e8617a04"],"secs":242,"stamp":"fd85e034c885a59e6f796523ceb4fdd6","tree":"877c9847704ef19cb69720bf09423afd2cce3434","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 81f68fe Nov 1, 2026
36 checks passed
@vpacher
vpacher deleted the fix/3400-mux-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_ffmpeg_mux_write_packet leaks its packet buffer (LeakSanitizer, valgrind)

1 participant