RFR: 8298321: 2 File Leak defect groups in 2 files [v3]
David Holmes
dholmes at openjdk.org
Tue Jan 10 05:06:53 UTC 2023
On Tue, 10 Jan 2023 00:49:59 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> Please review this simple change for fixing two file leak warnings:
>> 1) DirectivesParser::parse_from_file_inner() in open/src/hotspot/share/compiler/directivesParser.cpp
>> 2) mmap_attach_shared() in open/src/hotspot/os/posix/perfMemory_posix.cpp
>>
>> Please refer to the [comment](https://bugs.openjdk.org/browse/JDK-8298321?focusedCommentId=14549361&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14549361) in the bug report for details.
>>
>> Passed tiers 1 and 2 testing.
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>
> @iklam comment
src/hotspot/os/posix/perfMemory_posix.cpp line 1209:
> 1207:
> 1208: if (HAS_PENDING_EXCEPTION) {
> 1209: assert(fd == OS_ERR, "open_sharedmem_file always return OS_ERR on exceptions");
Does this really appease the static analysis tool?
src/hotspot/share/compiler/directivesParser.cpp line 105:
> 103: return parse_string(buffer, stream) > 0;
> 104: }
> 105: ::close(file_handle);
You could just move the existing `::close` to before the `if` statement ie close it immediately after the read.
-------------
PR: https://git.openjdk.org/jdk/pull/11909
More information about the hotspot-dev
mailing list