Closed Bug 266259 Opened 20 years ago Closed 19 years ago

memory leak in nsCharsetConverterManager::GetCharsetLangGroupRaw()

Categories

(Core :: Internationalization, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: eagle.lu, Assigned: smontagu)

References

Details

(Keywords: memory-leak)

Attachments

(2 files)

Following codes fragement will cause memory leak:
In nsCharsetConvertManager::GetCharsetLangGroupRaw()
{
 ...
 res = GetBundleValue(mDataBundle, aCharset, NS_LITERAL_STRING(".LangGroup"),
langGroup);
 
 *aResult = NS_NewAtom(langGroup);

 return res;
}

If the call GetBundleValue() fails. NS_NewAtom(langGroup) will be called.

But in the following codes (in SetCharsetLangGroup()):

res = gCharSetManager->GetCharsetLangGroupRaw(aCharSetInfo->mCharSet,
                                                &aCharSetInfo->mLangGroup);
if (NS_FAILED(res)) {
  aCharSetInfo->mLangGroup = NS_NewAtom("");

if NS_FAILED(res) is true, NS_NewAtom("") will be called, which will cause the
reference count of (class AtomImpl*)(aCharSetInfo->mLangGroup) to increse twice.
This is incorrect.
Attached patch patch v0Splinter Review
Comment on attachment 163553 [details] [diff] [review]
patch v0

Can you give r/sr? Thanks
Attachment #163553 - Flags: superreview?(blizzard)
Attachment #163553 - Flags: review?(smontagu)
Comment on attachment 163553 [details] [diff] [review]
patch v0

r=smontagu
Attachment #163553 - Flags: review?(smontagu) → review+
Keywords: mlk
*** Bug 266386 has been marked as a duplicate of this bug. ***
Attachment #163553 - Flags: superreview?(blizzard) → superreview?(neil.parkwaycc.co.uk)
Attachment #163553 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Comment on attachment 182237 [details] [diff] [review]
same patch but based on latest code base

transfering r/sr and asking for a to all branches. This is a very low risk
patch that gets rid of a memory leak.
Attachment #182237 - Flags: superreview+
Attachment #182237 - Flags: review+
Attachment #182237 - Flags: approval1.8b2?
Attachment #182237 - Flags: approval1.7.8?
Attachment #182237 - Flags: approval-aviary1.1a?
Attachment #182237 - Flags: approval-aviary1.0.4?
checked in trunk
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
urh... the tree is frozen so that you're not supposed to check in without approval.
Comment on attachment 182237 [details] [diff] [review]
same patch but based on latest code base

a=chofmann for trunk only. this will get the fix in 1.1a and 1.8b2.   we are
only taking critical security fixes on the branches
Attachment #182237 - Flags: approval1.8b2?
Attachment #182237 - Flags: approval1.8b2+
Attachment #182237 - Flags: approval1.7.8?
Attachment #182237 - Flags: approval1.7.8-
Attachment #182237 - Flags: approval-aviary1.1a?
Attachment #182237 - Flags: approval-aviary1.1a+
Attachment #182237 - Flags: approval-aviary1.0.4?
Attachment #182237 - Flags: approval-aviary1.0.4-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: