memory leak in ime code

RESOLVED FIXED in mozilla0.8.1

Status

()

Core
Internationalization
RESOLVED FIXED
17 years ago
8 years ago

People

(Reporter: Frank Tang, Assigned: Frank Tang)

Tracking

({inputmethod})

Trunk
mozilla0.8.1
PowerPC
Mac System 8.5
inputmethod
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

17 years ago
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)
(Assignee)

Comment 1

17 years ago
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
(Assignee)

Comment 3

17 years ago
fix and check in .
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 4

17 years ago
Frank, can you include some steps how IQA can verify this bug or assign this bug
to someone in engineering for verification? 

Comment 5

17 years ago
reassigned QA to ftang for verification or to provide a test case for QA to verify
QA Contact: andreasb → ftang
Keywords: inputmethod
You need to log in before you can comment on or make changes to this bug.