RFR: 8212034: Potential memory leaks in jpegLoader.c in error case

Johan Vos jvos at openjdk.java.net
Wed Nov 27 21:13:40 UTC 2019


On Wed, 27 Nov 2019 11:58:18 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

> Memory allocated in initDecompressor() and decompressIndirect() is not freed in error case.
> In error case,
> 1. Allocated memory should be freed.
> 2. Appropriate de-initialization jpeg library calls should be added.
> 
> Verified that,
> 1. All unit and systems tests pass on three platforms, and
> 2. Memory consumption with and without fix is similar by comparing memory before and after showing 10 jpeg images for 100 times.
> 
> ----------------
> 
> Commits:
>  - 7af932b7: 8212034: Memory leaks in jpegLoader.c in error case
> 
> Changes: https://git.openjdk.java.net/jfx/pull/54/files
>  Webrev: https://webrevs.openjdk.java.net/jfx/54/webrev.00
>   Issue: https://bugs.openjdk.java.net/browse/JDK-8212034
>   Stats: 62 lines in 1 file changed: 36 ins; 14 del; 12 mod
>   Patch: https://git.openjdk.java.net/jfx/pull/54.diff
>   Fetch: git fetch https://git.openjdk.java.net/jfx pull/54/head:pull/54

modules/javafx.graphics/src/main/native-iio/jpegloader.c line 1345:

> 1344:         free(cinfo->err);
> 1345:         free(cinfo);
> 1346:         ThrowByName(env, "java/io/IOException", buffer);

jerr_mgr is also allocated via malloc, but not freed. Do you want to free that too?

PR: https://git.openjdk.java.net/jfx/pull/54


More information about the openjfx-dev mailing list