mirror of
https://github.com/gen2brain/cam2ip.git
synced 2026-07-02 21:28:09 +00:00
Fix V4L device handle leak
This commit is contained in:
@@ -58,6 +58,13 @@ func New(opts Options) (c *Camera, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
c.camera.Close()
|
||||
c.camera = nil
|
||||
}
|
||||
}()
|
||||
|
||||
configs, e := c.camera.ListConfigs()
|
||||
if e != nil {
|
||||
err = fmt.Errorf("camera: can not list configs: %w", e)
|
||||
|
||||
Reference in New Issue
Block a user