JDK-6379118 : Memory leak in Java_sun_awt_shell_Win32ShellFolder2_getIconBits(), ShellFolder.cpp
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86
  • Submitted: 2006-01-31
  • Updated: 2011-02-16
  • Resolved: 2006-03-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b76Fixed
Related Reports
Relates :  
Description
This bug originated from the following question raised by Fujitsu engineers:

==== Fujitsu Question Start ===
When we investigate the src fix diff. for 4745575,
we find out the portion which seems to cause resource leak. 

In src/windows/native/sun/windows/ShellFolder.cpp(1.4.2_11),

The current line#702 - 706 is
------->
// Get the screen DC
HDC dc = GetDC(NULL);
if (dc == NULL) {
return NULL;
}
<------
However, if dc==NULL, resource leak seems to occur.

We think that portion should be as follows.
------>
// Get the screen DC
HDC dc = GetDC(NULL);
if (dc == NULL) {
+ ::DeleteObject(iconInfo.hbmColor);
+ ::DeleteObject(iconInfo.hbmMask);
return NULL;
}
<----- 

=====Fujitsu Question End =====

Comments
EVALUATION Should be fixed as suggested in the description.
31-01-2006