mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
rtsp: fix memory leak when closing sessions (#4964) (#4678) (#4967)
Some checks are pending
code_lint / go (push) Waiting to run
code_lint / go_mod (push) Waiting to run
code_lint / docs (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
Some checks are pending
code_lint / go (push) Waiting to run
code_lint / go_mod (push) Waiting to run
code_lint / docs (push) Waiting to run
code_lint / api_docs (push) Waiting to run
code_test / test_64 (push) Waiting to run
code_test / test_32 (push) Waiting to run
code_test / test_e2e (push) Waiting to run
This commit is contained in:
parent
0c801564fd
commit
e8b746b6d5
1 changed files with 6 additions and 3 deletions
|
|
@ -102,10 +102,9 @@ func (s *session) initialize() {
|
|||
}
|
||||
|
||||
// Close closes a Session.
|
||||
// this is not always called, so things that need to be released
|
||||
// must go in onClose().
|
||||
func (s *session) Close() {
|
||||
s.discardedFrames.Stop()
|
||||
s.decodeErrors.Stop()
|
||||
s.packetsLost.Stop()
|
||||
s.rsession.Close()
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +135,10 @@ func (s *session) onClose(err error) {
|
|||
s.path = nil
|
||||
s.stream = nil
|
||||
|
||||
s.discardedFrames.Stop()
|
||||
s.decodeErrors.Stop()
|
||||
s.packetsLost.Stop()
|
||||
|
||||
s.Log(logger.Info, "destroyed: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue