mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
#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
This commit is contained in:
parent
81c3bb18d5
commit
2c8314b3ba
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user