Skip to content

Flag Sink objects that are never closed #57281

Closed
@filiph

Description

@filiph
class A {
  IOSink _sink;
  void init(filename) {
    _sink = new File(filename).openWrite();
  }
}

Here's another linter hint that's standard-lib-specific (something like C linter hints complaining about unsafe use of memcpy, malloc, etc.). Whenever there is a Sink object that is opened in scope but never called close() upon in that same scope, that's a pretty strong indication the developer forgot.

We could easily identify other similar classes that have to be closed (or unsubscribed from) when no longer in use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions