Repository navigation
media-playback: Return the packet to the pool when a read fails - #466
Merged
Merged
Conversation
mp_media_next_packet takes a packet from the pool (or allocates one) before av_read_frame, and on a failed read (a network timeout, EOF, an abort) returned without putting it back, so it leaked. LeakSanitizer and valgrind both reported it from test_media_network_timeout. Closes #463 Local-Gate: v1 tree=6d9a78ce9a7323dd24a5e7fca4ce6bac145f9707 secs=359 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791872495,"gate":"rust/all/fmt","host":"linux-x86_64","key":"458ee7e0887c6798f14897589ce78f638a4992ee0d2d42e4e20ea9d86b2eb84d","lane":"lint","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":37,"stamp":"e5e1aa47fd7f0e1b028495bf3aaa4444","tree":"6d9a78ce9a7323dd24a5e7fca4ce6bac145f9707","v":1,"via":"run"} Ci-Attestation: {"at":1791872495,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"458ee7e0887c6798f14897589ce78f638a4992ee0d2d42e4e20ea9d86b2eb84d","lane":"lint","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":37,"stamp":"227677642eef9ace75b364935ffcde73","tree":"6d9a78ce9a7323dd24a5e7fca4ce6bac145f9707","v":1,"via":"run"} Ci-Attestation: {"at":1791872495,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"ba396a812f84bd8ea4be071002de130266fb0db2b6ea16bc17cdb3ae0a78facf","lane":"rust-test","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":239,"stamp":"f3ae09b965dd163064621d43e445a37e","tree":"6d9a78ce9a7323dd24a5e7fca4ce6bac145f9707","v":1,"via":"run"} Ci-Attestation: {"at":1791872495,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"a9701f427ed32186eb589780bb4727f148fa4271ed7e6cfcc34e28e7bc795a19","lane":"tier2-linux","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":82,"stamp":"42b4ac2617491e708fff05a042441dc5","tree":"6d9a78ce9a7323dd24a5e7fca4ce6bac145f9707","v":1,"via":"run"}
Member
Author
|
ASan pass on this branch (run 38356256911): |
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #463.
mp_media_next_packettakes a packet frompacket_pool(orav_packet_allocs one) beforeav_read_frame. On a failed read (a network timeout, EOF,AVERROR_EXIT) it returned without putting the packet back, so the packet leaked. LeakSanitizer and valgrind both reported it fromtest_media_network_timeout(master's run 38351762501:av_malloc←mp_media_next_packetmedia.c:176 ←mp_media_reset). Upstream OBS code, unchanged in this fork.Fix:
mp_media_free_packet(media, pkt)on the error path. That unrefs the packet and returns it to the pool, whichmp_media_freedrains.Evidence: the leak only shows under a sanitizer (Tier 2 doesn't run ASan), so the RED is master's ASan run above and the GREEN is the ASan pass on this branch, run 38356256911. Its result will be posted here. Tier 2
--repeat 3 --tests test_mediapasses OFF/ON (7/7), and the local gate passed and is stamped.