[OpenJDK 2D-Dev] RFR: Backport :8073699: Memory leak in jdk/src/java/desktop/share/native/libjavajpeg/imageioJPEG.c

Andrew Brygin andrew.brygin at oracle.com
Mon Apr 20 19:07:45 UTC 2015


Hi Phil,

  it looks fine to me.

Thanks,
Andrew

20/04/15 21:49, Phil Race пишет:
> Andrew & Sergey,
>
> Please review this identical 8u60 backport (diff below) of the JDK 9 
> fix : http://hg.openjdk.java.net/jdk9/hs/jdk/rev/b7e402c9b183
>
> hg diff imageioJPEG.c
> diff --git a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c 
> b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
> --- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
> +++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
> @@ -2778,6 +2778,14 @@
>      pb = &data->pixelBuf;
>
>      if (setPixelBuffer(env, pb, buffer) == NOT_OK) {
> +        if (scale != NULL) {
> +            for (i = 0; i < numBands; i++) {
> +                if (scale[i] != NULL) {
> +                    free(scale[i]);
> +                }
> +            }
> +            free(scale);
> +        }
>          return data->abortFlag;  // We already threw an out of memory 
> exception
>      }
>
> -phil.




More information about the 2d-dev mailing list