Closed Bug 1474928 Opened 2 years ago Closed 2 years ago

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

Categories

(GeckoView :: General, defect, P3)

Unspecified
Android
defect

Tracking

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

RESOLVED FIXED
mozilla63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed

People

(Reporter: rbartlensky, Assigned: rbartlensky)

References

Details

Attachments

(1 file)

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;
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 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+
Blocks: infer
Keywords: checkin-needed
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d28be9c59ecb
Close files and connections. r=nalexander
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d28be9c59ecb
Status: NEW → RESOLVED
Closed: 2 years ago
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.
OS: Unspecified → Android
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.