#122081 Universalchardet leaks memory
The fix for the nsCharSetProber class declaration, plus fix for nsUniversalDetector methods, which may cause another leak when the object is reused after Reset(). Patch proposed by Takayuki Tamura r=shanjian, sr/a=brendan git-svn-id: svn://10.0.0.236/trunk@115176 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -50,6 +50,7 @@ typedef enum {
|
||||
|
||||
class nsCharSetProber {
|
||||
public:
|
||||
virtual ~nsCharSetProber() {};
|
||||
virtual const char* GetCharSetName() = 0;
|
||||
virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen) = 0;
|
||||
virtual nsProbingState GetState(void) = 0;
|
||||
|
||||
@@ -89,7 +89,6 @@ nsUniversalDetector::Reset()
|
||||
mDone = PR_FALSE;
|
||||
mBestGuess = -1; //illegal value as signal
|
||||
mInTag = PR_FALSE;
|
||||
mEscCharSetProber = nsnull;
|
||||
|
||||
mStart = PR_TRUE;
|
||||
mDetectedCharset = nsnull;
|
||||
@@ -148,8 +147,10 @@ void nsUniversalDetector::HandleData(const char* aBuf, PRUint32 aLen)
|
||||
mInputState = eHighbyte;
|
||||
|
||||
//kill mEscCharSetProber if it is active
|
||||
if (mEscCharSetProber)
|
||||
if (mEscCharSetProber) {
|
||||
delete mEscCharSetProber;
|
||||
mEscCharSetProber = nsnull;
|
||||
}
|
||||
|
||||
//start multibyte and singlebyte charset prober
|
||||
if (nsnull == mCharSetProbers[0])
|
||||
|
||||
Reference in New Issue
Block a user