Skip to content

Webcam should prevent double close #56

@edaniels

Description

@edaniels

In https://github.com/blackjack/webcam/blob/master/webcam.go#L276, a user may accidentally (due to a bug) call Close more than once. This is particularly dangerous since we're holding to a raw file descriptor number. This could play out as:

  1. First close (normal, expected)
  2. Some other code opens a file and gets that now unused file descriptor number
  3. Second close (bug, unexpected) and now the other code has its file descriptor unexpectedly modified

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions