mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-05 07:36:57 +08:00
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.
This commit is contained in:
@@ -168,6 +168,7 @@ func (s *rtspSource) runInner() bool {
|
|||||||
s.log(logger.Info, "ERR: %s", err)
|
s.log(logger.Info, "ERR: %s", err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
defer c.Close()
|
||||||
|
|
||||||
readErr := make(chan error)
|
readErr := make(chan error)
|
||||||
go func() {
|
go func() {
|
||||||
@@ -231,7 +232,6 @@ func (s *rtspSource) runInner() bool {
|
|||||||
return true
|
return true
|
||||||
|
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
c.Close()
|
|
||||||
<-readErr
|
<-readErr
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user