summaryrefslogtreecommitdiff
path: root/annotations/generate_annotated_java_files.py
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2018-09-06 14:34:27 +0100
committerTobias Thierer <tobiast@google.com>2018-09-10 13:49:22 +0100
commit2b3c1beefc283b9e5980bf004d6377495d5ee78a (patch)
tree7b5708c500f2b71d86ab1ba8d4ac6808437e46b2 /annotations/generate_annotated_java_files.py
parent6b6c61e48b27c9c166bd6dfb036685816e37c9d4 (diff)
Fix GZIPInputStream ctor leaking an un-end()ed Inflater when it throws.
Prior to this fix, when readHeader(in) threw an Exception, the Inflater constructed a couple lines above leaked without its end() method having been called. This means that the Inflater relied on finalization alone, which is not reliable, to call end() and thus clear its zsRef. When StrictMode.DETECT_VM_CLOSABLE_LEAKS is enabled, this triggered a strict mode error during finalization. This CL fixes the code to end() the Inflater if readHeader() throws an Exception (on equivalently, RuntimeException | IOException). Test: The added test fails before this CL ("Unreleased resources found in test", found by ResourceLeakageDetector) but passes after it. Test: When running the test method separately (without the ResourceLeakageDetector) through Android Studio, with surrounding code (not part of this CL) setting StrictMode.DETECT_VM_CLOSABLE_LEAKS and triggering finalization, a StrictMode warning / stacktrace shows up in logcat before but not after this CL. Bug: 113790020 Change-Id: Ie7d5b2e2101d57232e3cc76f74ed7be7860929e1
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions