RFR: 8298321: 2 File Leak defect groups in 2 files [v3]
Calvin Cheung
ccheung at openjdk.org
Tue Jan 10 20:21:26 UTC 2023
On Tue, 10 Jan 2023 05:01:42 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> 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?
The static analysis tool should be fine about the above change. As I mentioned in the bug report, the warning is regarding the fd is not closed under the conditions HAS_PENDING_EXCEPTION and fd != OS_ERR.
I will run rerun the test to be sure.
> 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.
I agree and have pushed another commit with your suggestion.
-------------
PR: https://git.openjdk.org/jdk/pull/11909
More information about the hotspot-dev
mailing list