Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8212034: Potential memory leaks in jpegLoader.c in error case #54

Closed

Conversation

@arapte
Copy link
Member

arapte commented Nov 27, 2019

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.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8212034: Potential memory leaks in jpegLoader.c in error case

Reviewers

  • Johan Vos (jvos - Reviewer)
  • Kevin Rushforth (kcr - Reviewer)

Download

$ git fetch https://git.openjdk.java.net/jfx pull/54/head:pull/54
$ git checkout pull/54

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 27, 2019

👋 Welcome back arapte! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request (refresh this page to view it).

@openjdk openjdk bot added the rfr label Nov 27, 2019
@mlbridge
Copy link

mlbridge bot commented Nov 27, 2019

Webrevs

@kevinrushforth kevinrushforth self-requested a review Nov 27, 2019
@kevinrushforth
Copy link
Member

kevinrushforth commented Nov 27, 2019

This will need two reviewers.

Copy link
Collaborator

johanvos left a comment

In general, this makes sense. I need to look into more detail that the additional calls for freeing resources (in case of errors) don't cause e.g. segmentation violations and lead to a crash -- which would be worse than throwing an Exception.
I expect memory consumption to be similar before and after this patch if you don't run into errors, but did you check memory consumption before/after this patch in case of errors?

@kevinrushforth
Copy link
Member

kevinrushforth commented Jan 24, 2020

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jan 24, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@openjdk openjdk bot added the outdated label Feb 4, 2020
@openjdk openjdk bot removed the outdated label Feb 7, 2020
@arapte
Copy link
Member Author

arapte commented Feb 7, 2020

The PR was outdated. It is now merged with latest master.
Please take a look.

@arapte
Copy link
Member Author

arapte commented Feb 11, 2020

@johanvos , @arajkumar
Could you please take a re-look at the updated PR.

@arapte
Copy link
Member Author

arapte commented Mar 2, 2020

@johanvos , @arajkumar
Could you please take a re-look at the updated PR.

Copy link
Collaborator

johanvos left a comment

Looks good to me. I paid special attention to null pointer dereferencing when cleaning up resources, but I couldn't spot a trace that could cause this.

@openjdk
Copy link

openjdk bot commented Mar 5, 2020

@arapte This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

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

Reviewed-by: jvos, kcr
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 23 commits pushed to the master branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate f25e8cf22349425003120ef2d0a8c580d5cb2d95.

➡️ To integrate this PR with the above commit message, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Mar 5, 2020
@arapte
Copy link
Member Author

arapte commented Mar 6, 2020

/integrate

@openjdk openjdk bot closed this Mar 6, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Mar 6, 2020
@openjdk
Copy link

openjdk bot commented Mar 6, 2020

@arapte The following commits have been pushed to master since your change was applied:

  • b2ac76a: 8240451: JavaFX javadoc build fails with JDK 14
  • cf0bba6: 8240211: Stack overflow on Windows 32-bit can lead to crash
  • 337ed72: 8237926: Potential memory leak of model data in javafx.scene.control.ListView
  • 960f039: 8208761: Update constant collections to use the new immutable collections
  • 10c9528: 8240265: iOS: Unnecessary logging on pinch gestures
  • 4c132cd: 8237889: Update libxml2 to version 2.9.10
  • 20328b3: 8240218: IOS Webkit implementation broken
  • 4c82af8: 8236832: [macos 10.15] JavaFX Application hangs on video play on Cata…
  • 9cd6f79: 8196586: Remove use of deprecated finalize methods from javafx property objects
  • ef2f9ce: 8238755: allow to create static lib for javafx.media on linux
  • c3ee1a3: 8239822: Intermittent unit test failures in RegionCSSTest
  • 3150562: 8235772: Remove use of deprecated finalize method from PiscesRenderer and AbstractSurface
  • 4eaff0d: 8239109: Update SQLite to version 3.31.1
  • d8e7f85: 8239454: LLIntData : invalid opcode returned for 16 and 32 bit wide instructions
  • 48ddd80: Merge
  • 35a01ca: 8228867: Fix mistakes in FX API docs
  • b5e65ec: 8238434: Ensemble: Update version of Lucene to 7.7.2
  • e986459: 8227619: Potential memory leak in javafx.scene.control.ListView
  • a74137a: 8236839: System menubar removed when other menubars are created or modified
  • 21d3b7e: 8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering
  • e224e54: 8238526: Cherry pick GTK WebKit 2.26.3 changes
  • 6968e38: 8237469: Inherited styles don't update when node is moved

Your commit was automatically rebased without conflicts.

Pushed as commit f25e8cf.

@mlbridge
Copy link

mlbridge bot commented Mar 9, 2020

Mailing list message from Ambarish Rapte on openjfx-dev:

Changeset: f25e8cf
Author: Ambarish Rapte <arapte at openjdk.org>
Date: 2020-03-06 08:23:04 +0000
URL: https://git.openjdk.java.net/jfx/commit/f25e8cf2

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

Reviewed-by: jvos, kcr

! modules/javafx.graphics/src/main/native-iio/jpegloader.c

@arapte arapte deleted the arapte:jpegloader_potential_memory_leaks branch Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.