Closed Bug 71324 Opened 24 years ago Closed 24 years ago

memory leak in ime code

Categories

(Core :: Internationalization, defect)

PowerPC
Mac System 8.5
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.8.1

People

(Reporter: ftang, Assigned: ftang)

Details

(Keywords: inputmethod)

I think I find a memory leak in the ime code.

In mozilla/content/events/src/nsDOMEvent.cpp, we allocate an array of 
nsIPrivateTextRange* and pass to new nsPrivateTextRangeList(((nsTextEvent*
)aEvent)->rangeCount,tempTextRangeList); but in the  mozilla/content/event/src/
nsPrivateTextRange.cpp 
nsPrivateTextRangeList::~nsPrivateTextRangeList we didn't delete  the mList.

This probably introdue small amout of memory leak. We should fix this.

Here is the patch
Index: mozilla/content/events/src/nsPrivateTextRange.cpp
===================================================================
RCS file: /cvsroot/mozilla/content/events/src/nsPrivateTextRange.cpp,v
retrieving revision 1.4
diff -u -5 -r1.4 nsPrivateTextRange.cpp
--- nsPrivateTextRange.cpp	1999/12/21 19:27:39	1.4
+++ nsPrivateTextRange.cpp	2001/03/08 19:45:14
@@ -85,12 +85,15 @@
 }
 
 nsPrivateTextRangeList::~nsPrivateTextRangeList(void)
 {
 	int	i;
-	for(i=0;i<mLength;i++)
-		mList[i]->Release();
+	if(mList) {
+		for(i=0;i<mLength;i++)
+			mList[i]->Release();
+		delete [] mList;
+	}
 }
 
 NS_IMPL_ISUPPORTS1(nsPrivateTextRangeList, nsIPrivateTextRangeList)
 
 NS_METHOD nsPrivateTextRangeList::GetLength(PRUint16* aLength)
r=nhotta
jst , can you sr this ?
Status: NEW → ASSIGNED
Summary: memory leak in ime code → memory leak in ime code
Target Milestone: --- → mozilla0.8.1
Looks good to me, sr=jst
fix and check in .
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Frank, can you include some steps how IQA can verify this bug or assign this bug
to someone in engineering for verification? 
reassigned QA to ftang for verification or to provide a test case for QA to verify
QA Contact: andreasb → ftang
You need to log in before you can comment on or make changes to this bug.