[Static Analysis] Resource leaked in gecko/CrashReporterService.java

RESOLVED FIXED in Firefox 63

Status

P3
normal
RESOLVED FIXED
8 months ago
3 months ago

People

(Reporter: rbartlensky, Assigned: rbartlensky)

Tracking

unspecified
mozilla63
Unspecified
Android

Firefox Tracking Flags

(firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

8 months ago
Infer outputs the following:

mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java:101: error: RESOURCE_LEAK
  resource of type `java.io.FileInputStream` acquired by call to `FileInputStream(...)` at line 93 is not released after line 101.
**Note**: potential exception at line 94
  99.               if (transferred > 0)
  100.                   inFile.delete();
  101. >         } catch (Exception e) {
  102.               Log.e(LOGTAG, "exception while copying minidump file: ", e);
  103.               return false;

mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java:101: error: RESOURCE_LEAK
  resource of type `java.io.FileOutputStream` acquired by call to `FileOutputStream(...)` at line 94 is not released after line 101.
**Note**: potential exception at line 96
  99.               if (transferred > 0)
  100.                   inFile.delete();
  101. >         } catch (Exception e) {
  102.               Log.e(LOGTAG, "exception while copying minidump file: ", e);
  103.               return false;
(Assignee)

Comment 1

8 months ago
mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java:237: error: RESOURCE_LEAK
  resource of type `java.io.FileReader` acquired by call to `new()` at line 236 is not released after line 237.
**Note**: potential exception at line 237
  235.           try {
  236.               BufferedReader reader = new BufferedReader(new FileReader(filePath));
  237. >             return readStringsFromReader(reader, stringMap);
  238.           } catch (Exception e) {
  239.               Log.e(LOGTAG, "exception while reading strings: ", e);

mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java:365: error: RESOURCE_LEAK
  resource of type `java.net.HttpURLConnection` acquired to `conn` by call to `openConnectionWithProxy(...)` at line 302 is not released after line 365.
**Note**: potential exception at line 309
  363.                   Log.w(LOGTAG, "Received failure HTTP response code from server: " + conn.getResponseCode());
  364.               }
  365. >         } catch (IOException e) {
  366.               Log.e(LOGTAG, "exception during send: ", e);
  367.           } catch (URISyntaxException e) {
Comment hidden (mozreview-request)

Comment 3

8 months ago
mozreview-review
Comment on attachment 8991345 [details]
Bug 1474928: Close files and connections.

https://reviewboard.mozilla.org/r/256244/#review263526

This looks fine to me.  If it's green on try, bombs away.
Attachment #8991345 - Flags: review?(nalexander) → review+
(Assignee)

Updated

8 months ago
Blocks: 1175203
(Assignee)

Updated

8 months ago
Keywords: checkin-needed

Comment 4

8 months ago
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d28be9c59ecb
Close files and connections. r=nalexander
Keywords: checkin-needed

Comment 5

8 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/d28be9c59ecb
Status: NEW → RESOLVED
Last Resolved: 8 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
I'm setting status-firefox62=wontfix because potential resource leaks in the crash reporter won't affect many users. :) If you think we might be losing crash reports without this fix, please feel free to change status-firefox62 and request beta uplift.
status-firefox61: --- → wontfix
status-firefox62: --- → wontfix
status-firefox-esr52: --- → wontfix
status-firefox-esr60: --- → wontfix
OS: Unspecified → Android

Updated

3 months ago
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 63 → mozilla63
You need to log in before you can comment on or make changes to this bug.