Closed Bug 289689 Opened 16 years ago Closed 15 years ago

Memory leak: nsDebugImpl::Assertion, Create Process

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: itay.perl, Assigned: bent.mozilla)

Details

(Keywords: fixed1.8.1, memory-leak)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050409 Firefox/1.0+

A memory leak occurs on nsDebugImpl.cpp: nsDebugImpl::Assertion:
CreateProcess seems to not be freed. have a look at the if:

      if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) &&
         NULL != (pName = strrchr(executable, '\\')) &&
         NULL != strcpy(pName+1, "windbgdlg.exe") &&
#ifdef DEBUG_jband
         (printf("Launching %s\n", executable), PR_TRUE) &&
#endif         
         CreateProcess(executable, buf, NULL, NULL, PR_FALSE,
                       DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
                       NULL, NULL, &si, &pi) &&
         WAIT_OBJECT_0 == WaitForSingleObject(pi.hProcess, INFINITE) &&
         GetExitCodeProcess(pi.hProcess, &code))
{
  //closing handle only of all these passed fine
  CloseHandle(pi.hProcess)
}
AFAIU, If one of the conditions is going wrong, the others will be also checked,
and the functions will be called, meaning CreateProcess will be called, but
never freed by CloseHandle. Please check this.

Reproducible: Always

Steps to Reproduce:
1.Just wait for an assertion...Nothing to reproduce here
2.
3.

Actual Results:  
Memory Leak

Expected Results:  
Not leak

Memory leak was detected using BoundsChecker
Keywords: mlk
Assignee: firefox → dougt
Component: General → XPCOM
Product: Firefox → Core
QA Contact: general
Version: unspecified → Trunk
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → EXPIRED
Reopening so this can get a yay/nay from someone who knows about such leaks.
Status: RESOLVED → UNCONFIRMED
Resolution: EXPIRED → ---
Yeah, this is an issue if WaitForSingleObject or GetExitCodeProcess somehow fail.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → Windows XP
Attached patch Fix v1.0Splinter Review
MSDN says that once CreateProcess completes we must use CloseHandle on the process. It's unlikely that the old code would fail, but this bulletproofs it.
Assignee: dougt → bent.mozilla
Status: NEW → ASSIGNED
Attachment #224253 - Flags: review?(dougt)
Attachment #224253 - Flags: review?(dougt) → review+
Does this need sr?
Comment on attachment 224253 [details] [diff] [review]
Fix v1.0

never hurts, but isn't required.  ask darin.
Attachment #224253 - Flags: superreview?(darin)
Attachment #224253 - Flags: superreview?(darin) → superreview+
Comment on attachment 224253 [details] [diff] [review]
Fix v1.0

branch too?
Attachment #224253 - Flags: approval-branch-1.8.1?(darin)
Attachment #224253 - Flags: approval-branch-1.8.1?(darin) → approval-branch-1.8.1+
Checked in on trunk and branch.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago15 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.