From ef255af0933d54b9ffeb65e94d69e25deee925ba Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sun, 23 Jan 2022 19:36:33 +0100 Subject: [PATCH] rtsp source: fix memory leak This happened when the server was able to connect to the source, but initialization failed before or during the PLAY request. --- internal/core/rtsp_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/core/rtsp_source.go b/internal/core/rtsp_source.go index b399b3af..57c3f856 100644 --- a/internal/core/rtsp_source.go +++ b/internal/core/rtsp_source.go @@ -168,6 +168,7 @@ func (s *rtspSource) runInner() bool { s.log(logger.Info, "ERR: %s", err) return true } + defer c.Close() readErr := make(chan error) go func() { @@ -231,7 +232,6 @@ func (s *rtspSource) runInner() bool { return true case <-s.ctx.Done(): - c.Close() <-readErr return false }