<AWT Dev> [CAUTION] [OpenJDK 2D-Dev] RFR [XS]: 8231445: check ZALLOC return values in awt coding

Langer, Christoph christoph.langer at sap.com
Wed Sep 25 09:05:09 UTC 2019


Hi Matthias,

looks good to me.

Maybe you want to create a Macro for the repeating pattern:

graphicsConfigs[ind] = ZALLOC (_AwtGraphicsConfigData);
if (graphicsConfigs[ind] == NULL) {
    JNU_ThrowOutOfMemoryError(env, "allocation in getAllConfigs failed");
    goto cleanup;
}

in getAllConfigs?

Best regards
Christoph

From: 2d-dev <2d-dev-bounces at openjdk.java.net> On Behalf Of Baesken, Matthias
Sent: Mittwoch, 25. September 2019 09:40
To: awt-dev at openjdk.java.net; 2d-dev at openjdk.java.net
Subject: [CAUTION] [OpenJDK 2D-Dev] RFR [XS]: 8231445: check ZALLOC return values in awt coding

Hello, please review this small fix .  It deals with return value checking of ZALLOC .

ZALLOC is a macro using calloc, please  see :

jdk/src/java.desktop/unix/native/common/awt/awt_p.h
/* allocated and initialize a structure */
#define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T)))

    ...   so the return value has to be checked which is missing at some places.


Bug/webrev :

https://bugs.openjdk.java.net/browse/JDK-8231445

http://cr.openjdk.java.net/~mbaesken/webrevs/8231445.0/


Thanks, Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20190925/8c03c6d0/attachment.html>


More information about the awt-dev mailing list