Skip to content

Resource leak -- file not closed -- found by Facebook's static analyzer  #2

@dulmarod

Description

@dulmarod

Hello,
This resource leak report, included with comments
below, were found by running

Facebook's Infer static analyzer on RemoteDroid.

Regards,
Dulma Rodriguez
Facebook Static Analysis Tools Team

File: app/src/main/java/com/koushikdutta/async/util/StreamUtility.java

Report: Resource Leak: resource acquired by call to FileOutputStream(...) at line 83 is not released after line 86.

Remarks: The problem seems to be that dout.write(...) can throw an exception, in which case dout.close() won't get called. A simple fix is to put the call to close in a finally clause.

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