зеркало из https://github.com/mozilla/gecko-dev.git
#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:
Родитель
26c9d6edb3
Коммит
3c54b457a8
|
@ -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])
|
||||
|
|
Загрузка…
Ссылка в новой задаче