RFR: 8292214: Memory leak in getAllConfigs of awt_GraphicsEnv.c:386 [v2]
Alexander Zvegintsev
azvegint at openjdk.org
Fri Sep 30 14:55:38 UTC 2022
On Wed, 28 Sep 2022 17:31:39 GMT, Alisen Chung <achung at openjdk.org> wrote:
>> changed return to cleanup in getAllConfigs
>> changed cleanup to loop thru and free all allocated memory adjacent to graphicsConfig pointer
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
>
> changed loop end condition to ind-1
Marked as reviewed by azvegint (Reviewer).
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 575:
> 573: cleanup:
> 574: if (success != JNI_TRUE) {
> 575: for (int i = 0; i < ind-1; i++) {
New `int i` declaration shadows previously declared `i`, I think it can be reused.
src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 576:
> 574: if (success != JNI_TRUE) {
> 575: for (int i = 0; i < ind-1; i++) {
> 576: if (graphicsConfigs[i] != 0) {
It it fine as it is, but this check can be omitted since `free` is no-op for null pointer arguments.
-------------
PR: https://git.openjdk.org/jdk/pull/10378
More information about the client-libs-dev
mailing list